Disclaimer: HA newb trying to get first set of dimmers working the way I want…
I have several HS WD100+ dimmers, and I’m trying to build an automation that will work for each, without duplicating the same code throughout.
I used this thread to get it working on a single dimmer:
https://community.home-assistant.io/t/central-scene-command-class-fibaro-swipe-homeseer-ws-100d-switches/
I’m hoping to reuse the config to make life easier.
When I’m done, I’m expecting dbl tap up on any dimmer to set Brightness to 100% on that dimmer only.
This works for a single dimmer:
### - DIMMER Automation - ################
- alias: 'HSDimmer DBLTap Up'
# hide_entity: True
trigger:
platform: event
event_type: zwave.scene_activated
event_data:
entity_id: zwave.den_north_light
scene_id: 1
scene_data: 3
action:
service: light.turn_on
entity_id: light.den_north_light_level
data:
brightness: 255
Trying to use trigger.entity_id so the action only runs for the dimmer that registered the event isn’t working. I’ve tried multiple variations of this:
### - DEN DIMMER Automations - NOT WORKING ################
- alias: 'HSDimmer DBLTap Up'
# hide_entity: True
trigger:
platform: event
event_type: zwave.scene_activated
event_data:
entity_id: zwave.den_north_light
scene_id: 1
scene_data: 3
action:
service: light.turn_on
data_template:
data:
entity_id: >
{% if trigger.entity_id == 'zwave.den_north_light' %}light.den_north_light_level
{% elif trigger.entity_id == 'zwave.den_north_light_9' %}light.den_north_light_level
{% elif trigger.entity_id == 'zwave.den_mid_light' %}light.den_mid_light_level
{% elif trigger.entity_id == 'zwave.den_south_light' %}light.den_south_light_level
{% elif trigger.entity_id == 'light.den_north_light_level' %}light.den_north_light_level
{% elif trigger.entity_id == 'light.den_north_light_level_9_0' %}light.den_north_light_level
{% elif trigger.entity_id == 'light.den_mid_light_level' %}light.den_mid_light_level
{% elif trigger.entity_id == 'light.den_south_light_level' %}light.den_south_light_level
{% else %}CatchAll
{% endif %}
brightness: 255
At this point, I’m just working on the action. I should be able to list all of my entity_id’s in the trigger… I’m only testing on one dimmer right now, but it’s not working.
Logs show:
2017-09-15 20:38:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event zwave.scene_activated[L]: entity_id=zwave.den_north_light, node_id=9, scene_data=3, scene_id=1>
2017-09-15 20:38:25 INFO (MainThread) [homeassistant.components.automation] Executing HSDimmer DBLTap Up
2017-09-15 20:38:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: entity_id=automation.hsdimmer_dbltap_up, name=HSDimmer DBLTap Up, domain=automation, message=has been triggered>
2017-09-15 20:38:25 INFO (MainThread) [homeassistant.helpers.script] Script HSDimmer DBLTap Up: Running script
2017-09-15 20:38:25 INFO (MainThread) [homeassistant.helpers.script] Script HSDimmer DBLTap Up: Executing step call service
2017-09-15 20:38:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=139799716724632-5, service=turn_on, domain=light, service_data=data=entity_id=CatchAll, brightness=255>
2017-09-15 20:38:25 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: extra keys not allowed @ data['data']. Got {'entity_id': 'CatchAll', 'brightness': '255'}
2017-09-15 20:38:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=139799716724632-5>
I’d eventually like to use something like:
# entity_id: >
# {{'light.'+ trigger.entity_id.split('.')[1] +'_level' }}
But at this point, I’m not sure exactly what trigger.entity_id is set to… so I’m struggling to do anything with it!
Any assistant is greatly appreciated!