I’ve got two automations using the service_template. The first one should set Hue bulbs to 100% brightness when turned on. The second one is turning on two Hue bulbs and two switches controlled by Smartthings. Neither of them is working correctly. The first one fails completely when birghtness_pct included. The second, only the Smartthings switches turn on or off, the Hue bulbs aren’t working at all.
Any suggestions? I’m including my current code. First is called Master Bedroom Switch and the second is Living Room Switch.
alias: Master Bedroom Switch
initial_state: false
trigger:
- entity_id: switch.master_bedroom_switch
platform: state
to: 'on'
- entity_id: switch.master_bedroom_switch
platform: state
to: 'off'
trigger:
platform: mqtt
topic: "smartthings/Master Bedroom Switch/switch"
action:
entity_id: light.master_bedroom
service_template: >
{% if trigger.payload == 'on' %}
light.turn_on
brightness_pct: 100
{%- else -%}
light.turn_off
alias: Living Room Switch
initial_state: false
trigger:
- entity_id: switch.living_room_switch
platform: state
to: 'on'
- entity_id: switch.living_room_switch
platform: state
to: 'off'
trigger:
platform: mqtt
topic: "smartthings/Living Room Switch/switch"
action:
entity_id: light.living_room
service_template: >
{% if trigger.payload == 'on' %}
light.turn_on
{%- else -%}
light.turn_off
{% endif %}
entity_id: switch.living_room_outlets
service_template: >
{% if trigger.payload == 'on' %}
script.living_room_outlets_on
{%- else -%}
script.living_room_outlets_off
{% endif %}