mqqt restful api vs http api
Posted: Fri Feb 16, 2024 12:27 am
Hi,
I use mqqt to link Home Assistant with Indigo. Here is a typical automation entry that was working for me in the past. It keeps "living_room_fan" in sync between indigo and HASS. HASS is still able to receive commands from Indigo, but Indigo is no longer able to receive commands from HASS. That is, the line "indigo/devices/508358889/command/set'" is no longer being understood by Indigo even though it is being published to the mqqt server. This used to work until quite recently. Any help would be appreciated.
- alias: 'automation.living_room_fan'
trigger:
platform: state
entity_id: switch.living_room_fan
action:
- service: mqtt.publish
data:
topic: indigo/devices/508358889/command/set
payload_template: >
{% if is_state('switch.living_room_fan', 'on') %}
on
{% else %}
off
{% endif %}
- alias: 'mqtt.living_room_fan'
trigger:
platform: mqtt
topic: home-assistant-4m/mqtt.living_room_fan
action:
service_template: >
{% if (trigger.payload == 'true' or trigger.payload == 'True' ) %}
switch.turn_on
{% elif (trigger.payload == 'false' or trigger.payload == 'False' ) %}
switch.turn_off
{% endif %}
data:
entity_id:
- switch.living_room_fan
I use mqqt to link Home Assistant with Indigo. Here is a typical automation entry that was working for me in the past. It keeps "living_room_fan" in sync between indigo and HASS. HASS is still able to receive commands from Indigo, but Indigo is no longer able to receive commands from HASS. That is, the line "indigo/devices/508358889/command/set'" is no longer being understood by Indigo even though it is being published to the mqqt server. This used to work until quite recently. Any help would be appreciated.
- alias: 'automation.living_room_fan'
trigger:
platform: state
entity_id: switch.living_room_fan
action:
- service: mqtt.publish
data:
topic: indigo/devices/508358889/command/set
payload_template: >
{% if is_state('switch.living_room_fan', 'on') %}
on
{% else %}
off
{% endif %}
- alias: 'mqtt.living_room_fan'
trigger:
platform: mqtt
topic: home-assistant-4m/mqtt.living_room_fan
action:
service_template: >
{% if (trigger.payload == 'true' or trigger.payload == 'True' ) %}
switch.turn_on
{% elif (trigger.payload == 'false' or trigger.payload == 'False' ) %}
switch.turn_off
{% endif %}
data:
entity_id:
- switch.living_room_fan