I would love to have the ability to edit scenes build scenes based on current states and reload scenes all from the Gui.
This goes along with the new script and automation configuration pages.
I would love to have the ability to edit scenes build scenes based on current states and reload scenes all from the Gui.
This goes along with the new script and automation configuration pages.
First of all sorry for bringing up this topic up from that long. However I believe it has a valid point.
Im currently building up a smart home and Im planning ahead and testing, programing everything that I intent to use once its ready. In my set up I have a Philips Hue light, 5 bulbs to be exact. And I came across a situation of setting up the scenes for all the lights from Hue to HA.
Philips´ app works soo well! Changing colours and set up new scenes without a hassle what so ever. On the other hand HA just to copy the scenes I have set to HA is to say the least a LOT of copy and paste and multiples forth and back. I know this is not a easy situation, but at this moment I think it is far way from being friendly easy and pratical for a non savvy people that actually has to have “access” to the folder/config files.
I would love that this feature is added to HA. Not just to light and switches but any state that we could trigger. I think that would be a great addition to HA.
All the best,
Working off the Lovelace Jinja2 code (here https://sharethelove.io/tools/jinja-magic-scripts) I started working on this jinja2 code to be able to snapshot my current config for a scene. Credit goes to @skalavala for the code to get me started. I am still trying to figure out how to list out attributes for lights, covers, and media_player without manually listing them.
#Scene generator
scene:
- name: Home
{%- set domains = states | map(attribute='domain') |list | unique | list %}
{%- for item in domains if item != "camera" and item != "zone" and item != "sensor" and item != "sun" and item != "binary_sensor" and item != "persistent_notification" and item != "weather" and item != "scene" and item != "device_tracker" and item != "alert" %}
# {{item}}
entities:
{%- for e in states[item] %}
{%- if item != "light" %}
{{ e.entity_id }}: {{states(e.entity_id)}}
{%- endif %}
{%- if item == "light" %}
{{ e.entity_id }}:
state: {{states(e.entity_id)}}
brightness: {{state_attr( e.entity_id, "brightness")}}
xy_color: {{state_attr( e.entity_id, "xy_color")}}
{% endif %}
{%- endfor %}
{% endfor -%}
Unfortunately the attributes are different for different domains. For ex: the light
component’s attributes are not same as camera
component’s attributes. Instead, you could just list all the attributes and their values for each domain in the format that works for you/lovelace. I have written some scripts that does similar stuff, and plenty of other Jinja2 scripts that might help you if you are interested.
https://github.com/skalavala/smarthome/tree/master/jinja_helpers
Good luck!