So im trying to make a switch to turn on and off a DSP-W118 going trough Google assistant.
In switch.yaml
test:
value_template: "{{ is_state_attr('switch.test', 'sensor_state', 'on') }}"
turn_on:
service: rest_command.assistant_relay
data:
command: turn on test
entity_id: switch.test
from: 'off'
to: 'on'
turn_off:
service: rest_command.assistant_relay
data:
command: turn off test
entity_id: switch.test
from: 'on'
to: 'off'
In configuration.yaml
test_activity:
friendly_name: test
value_template: >
{% if is_state("switch.test", 'on') %}
{{ states.switch.test.attributes.current_activity }}
{% else %}
Off
{% endif %}
This i have taken from my Logitech remote setup. The main problem is that the switch does not change state. When the first command is sendt it turns the ligth on, but the lovelace card returns to off. If i go to “developer” tool and changed the state of the switch_test to on, i can go back into lovelace, see that the switch now is on, and then trigger it, and my DSP-W118 goes off.