Confused by name of entities

Hi

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 :frowning: 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 ?

Thanks,

Vincèn

For brightness, lights generally take a value between 0 and 254.

Try using this format:

- 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.

1 Like

@aimc thanks for clarification about level range :wink:
@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:

icon: mdi:ceiling-light
max_mireds: 500
node_id: 7
min_mireds: 154
friendly_name: Suspension Gradation
old_entity_id: light.canape_level_7_0
value_instance: 1
new_entity_id: light.canape_level
supported_features: 1
brightness: 18
value_index: 0

Curious about these max-min_mireds fields ???

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 :wink:

Thanks

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
1 Like

@mikenolet thanks a lot it solved my issue unless it’s completely illogical :frowning: I understand the short notation for off but it still should accept regular syntax too no ??

I think it does not accept a brightness as a 0 value when setting the state to off as they are one in the same.

@mikenolet yeb but if I remember well it was not accepting also a simple state: off !!