Send cmd via mqtt from Home assistant

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Send cmd via mqtt from Home assistant

#1 Post by Patou » 16 Nov 2020, 23:33

Hello,
I do not find in the topics of this forum or in the doc the exact way to send mqtt data from home assistant using 'cmd'
On a mqtt tracker I see the messages so mqtt is correctly configured. On Esp1 this is the configuration
MQTT-configuration.png
MQTT-configuration.png (19.21 KiB) Viewed 5967 times
When I use the MQTT helper I can receive the message from HA

I tried following without success :

Code: Select all

    - service: mqtt.publish
      data_template:
        topic: 'Esp1/cmd'
        retain: true
        payload: 'event:ha_start'  

Code: Select all

    - service: mqtt.publish
      data_template:
        topic: 'Esp1/cmd'
        retain: true
        payload: 'event,ha_start'  

Code: Select all

    - service: mqtt.publish
      data_template:
        topic: 'Esp1/control?cmd'
        retain: true
        payload: 'event,ha_start'  
In the Esp1 device :

Code: Select all

On ha_start do
 event,publish_data
endon
But on the log of Esp1 I do not see the event ... I do something wrong bur what ??
Thanks in advance for your help
Patou

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Send cmd via mqtt from Home assistant syntax

#2 Post by Patou » 17 Nov 2020, 01:33

Finally found the correct syntax :
Need "xx" and not 'xx' !!

Code: Select all

    - service: mqtt.publish
      data_template:
        topic: 'Volet_Living/cmd'
        retain: true
        payload: "event,ha_start" 

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Send cmd via mqtt from Home assistant

#3 Post by Patou » 17 Nov 2020, 02:02

Hello,
I also discover that firmware 'ESP_Easy_mega-20200426_normal_ESP8266_4M1M.bin' has the problem
but firmwares
- ESP_Easy_mega_20200812_normal_ESP8266_4M1M
- ESP_Easy_mega-20200310_normal_ESP8266_4M1M

have no problem !

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests