Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: I should be able to define define 'on' state easily in Button #353

Closed
saya6k opened this issue Feb 10, 2024 · 3 comments
Closed

FR: I should be able to define define 'on' state easily in Button #353

saya6k opened this issue Feb 10, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@saya6k
Copy link

saya6k commented Feb 10, 2024

Since there is template now, I can define preview value.

However, since I can't define when is 'on' or 'off' in button, I need to create every binary_sensor that indicate that define on or off of that button. Which is annoying.

I wish I can just define 'on' or 'off' state of that button with template.

@matt8707 matt8707 added the enhancement New feature or request label Feb 11, 2024
matt8707 added a commit that referenced this issue Feb 11, 2024
Fix button state template close #352 close #353
@realroywalker
Copy link

The change made does appear to have fixed the case sensitivity issue, but unless I miss something there isn't any way to configure what the 'on' state for a given button should be (which this FR requests) - Should we be seeing a new option somewhere to configure this?

@matt8707
Copy link
Owner

  • select an entity that is 'off'
  • add template (beside entity dropdown) to edit state
  • write on or any of these
    export const onStates = readable([
    'active',
    'auto',
    'cool',
    'dry',
    'fan_only',
    'heat',
    'heat_cool',
    'heating',
    'home',
    'on',
    'open',
    'playing',
    'unlocked',
    // vacuum
    'cleaning',
    'returning',
    // water_heater
    'eco',
    'electric',
    'performance',
    'high_demand',
    'heat_pump',
    'gas'
    ]);

@realroywalker
Copy link

Thanks - yes I see the logic now.
I think it would be useful to allow for decoupling the displayed 'state' on the button - for example I have a power socket which I would like to display the power draw attribute as the state for the button (which I now can thanks to the templates) but if I use that the button no longer goes 'on' since the 'state' is none of the values in the 'onStates' array you linked.

If the displayed state and 'on state' where 2 separate templates it would allow for that extra flexibility, since we could use templates to say for example if the entity_id state is > 10 output 'on' (which then matches against your static list).

Hopefully that makes sense and I'm not talking complete rubbish 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants