As I have setup nearly all my sensors and other devices in HA, I’m now trying to do my first automations in it using examples supplied on website like this one: https://home-assistant.io/cookbook/dim_lights_when_playing_media/ but I’m confused with entities !!
To try that sample on my system I updated entities names by the ones of my system but I get errors in log. So here is what I did in scene:
scene:
- name: Salon normal
entities:
zwave.canape:
state: on
light.canape_level:
level: 40
- name: Salon cinema
entities:
zwave.canape:
state: off
light.canape_level:
level: 20
but each time I play with the two scenes on my frontend nothing happens on my light circuit and I get that in logs of HA:
2017-07-07 14:51:16 WARNING (MainThread) [homeassistant.helpers.state] reproduce_state: Unable to reproduce state <state light.canape_level=None; level=20 @ 2017-07-07T14:48:15.642286+02:00> (2)
2017-07-07 14:51:16 WARNING (MainThread) [homeassistant.helpers.state] reproduce_state: Unable to reproduce state <state zwave.canape=off @ 2017-07-07T14:48:15.642474+02:00> (2)
2017-07-07 14:51:18 WARNING (MainThread) [homeassistant.helpers.state] reproduce_state: Unable to reproduce state <state light.canape_level=None; level=40 @ 2017-07-07T14:48:15.643012+02:00> (2)
2017-07-07 14:51:18 WARNING (MainThread) [homeassistant.helpers.state] reproduce_state: Unable to reproduce state <state zwave.canape=on @ 2017-07-07T14:48:15.643137+02:00> (2)
I used names listed in the States tab of HA but it looks it’s not what he expected For info the ZWave device I try to control here is an Everspring dimmer socket (I control it perfectly through the States tab of HA).
Side question: what is the unit of ZWave levels ? Found nothing on Internet out of most people looks to use % but is it really percentage or a analog value ?
- name: Relax
entities:
switch.under_cabinet:
state: off
light.kitchen_main_level:
state: off
light.kitchen_pendant_level:
state: on
brightness: 3
light.family_room_level:
state: on
brightness: 66
light.downstairs_hallway_level:
state: off
light.kitchen_sink_level:
As mentioned you use brightness to pass the brightness value using 0-254.
@aimc thanks for clarification about level range @mikenolet thanks for sample code so I adapted it at mine but I still have an error when I try to run the scene as it looks it doesn’t want the brightness parameter:
2017-07-08 08:52:56 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_off: extra keys not allowed @ data['brightness']. Got 0
It’s a dimmer socket I control in ZWave and not a light dimmer by itself, may it be the difference ? When I look at device details in Developer tools it lists these:
Little update. Unless the error message in log it already works in part. Here is code I wrote:
scene:
- name: Salon normal
entities:
light.canape_level:
state: on
brightness: 110
- name: Salon cinema
entities:
light.canape_level:
state: on
brightness: 50
- name: Salon off
entities:
light.canape_level:
state: off
brightness: 0
Unless the error in log the two Salon Normal and Salon Cine presets are working with light dim at requested level. The only thing I don’t understand is that the scene Salon Off is doing nothing at all (unless I putted Brightness at 0 and states at off). Any ideas why it would not want the off ?? the dimmer is an Everspring wall socket for info
You do not have to pass a brightness level of 0 when turning off a light. you can simply say off as follows.
- name: Relax
entities:
switch.under_cabinet: off
light.kitchen_main_level: off
light.kitchen_pendant_level:
state: on
brightness: 3
light.family_room_level:
state: on
brightness: 66
light.downstairs_hallway_level: off
light.kitchen_sink_level: off
So in your case
scene:
- name: Salon normal
entities:
light.canape_level:
state: on
brightness: 110
- name: Salon cinema
entities:
light.canape_level:
state: on
brightness: 50
- name: Salon off
entities:
light.canape_level: off
@mikenolet thanks a lot it solved my issue unless it’s completely illogical I understand the short notation for off but it still should accept regular syntax too no ??