-
Notifications
You must be signed in to change notification settings - Fork 441
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
Enable "switch mode" for vertical_buttons_custom_state #191
Comments
I think you are using the card template wrong. So the end users template to use for this card would for example be rather: configuration.yaml input_select:
status_person:
name: 'Status • Person'
options:
- home
- away
- exercise
- work
- sleep lovelace-minimalist.yaml - type: 'custom:button-card'
template: vertical_buttons_custom_state
variables:
state: home
color: purple
entity: input_select.status_person
icon: 'mdi:home-variant' |
Ok, is a different use case. I am using it as a switch on/off and it is foreseen as input select and each button reflects one state. |
I also use my vertical buttons for toggle on off scenes. If you add this UI template
I also created an input_boolean and connected that to the button which i use to toggle on/off. I then have automations that triggers on a state change and sets the appropriate scene:
This is the button defintion i have in my UI file
Hope this helps you to acheive what you want. Let me know if you need more input/help. |
Ok, I would turn this into a feature request once, so that the vertical button cards also support some kind of switch mode. Maybe @saxel can have a look into it, if he has time |
I believe that it's possible to cover the scenarios in one custom card called Scenario 1:
Scenario 2:
|
How do we handle the color option, i guess it would be beneficial to choose what color the card has as ON? Some cards use an css string as input, others use an option to set color. Should we follow the same structure for all variables then we should have this as option for color:
|
I've created a first draft of a new vertical button, it works with input_select or input_boolean but that required some scripting so its possible to support other type of entities. However i have issues with fixing the backwards compatibility , but i will have to check that another day... if i dont manage to fix that i will submit a PR based on what I have. usage:
card:
|
I have been away for new years, and turns out I have caught covid so count me out. I also need to check up on what has happened in the repo during the holidays since a lot of things happened :) As for the card I think it is a great addition if the same template could support both input_select and input_boolean 👍 |
Oh my, I wish you a speedy recovery! Take care of yourself. |
Get well @saxel! I need some help on this one. I have managed to create the card but when I try to handle the backwards compatibility i get a javascript error telling me the variables is not defined... i have not been able to figure out what the issues are: I have checked in an updated template file in my fork here; https://github.com/mp-se/UI this is the defintion i have tested with:
this is the wrapper i created for backwards compatibility which is simlar to other that exist in the file.
When I run this I get "ButtonCardJSTemplateError: TypeError: Cannot read properties of undefined (reading 'state') in 'return variables.state'" and it looks like the whole variables is undefined when this template is applied.... could it be some kind of bug in button_card? |
Fixed in PR #211 |
Should be added with #211 |
I was trying to implement vertical buttons in my environment and it did not work for me. The color were not shown and when got the color it still was not changing the state from 'on' to 'off'.
I changed the default state and the tap on action. In future a flexible color as variable would also be helpful for the community. Here my code: (see also post in Forum)
The text was updated successfully, but these errors were encountered: