I’m working on tracking down a bug in my HASP project and I’ve narrowed it down to behavior I’m seeing in Hass where MQTT messages incoming under the
homeassistant namespace trigger automations twice, but only if discovery is enabled.
I’ve deployed a clean installation of Hass 0.67.1 on a VM named
hasstest running a new installation of Ubuntu 16.04. I have added the following lines to the stock config (link to full configuration.yaml):
mqtt: discovery: true
I’ve then created two simple automations in
automations.yaml as shown below:
- alias: TestAutomation1 trigger: - platform: mqtt topic: 'homeassistant/test1' payload: 'trigger' action: - service: mqtt.publish data: topic: 'homeassistant' payload: 'TestAutomation1 response' - alias: TestAutomation2 trigger: - platform: mqtt topic: 'test2/test2' payload: 'trigger' action: - service: mqtt.publish data: topic: 'homeassistant' payload: 'TestAutomation2 response'
When I send the following command, I receive two responses:
mosquitto_pub -t homeassistant/test1 -m trigger -h hasstest -V mqttv311
2018-04-22 09:22:10.906 homeassistant/test1 trigger 2018-04-22 09:22:10.947 homeassistant TestAutomation1 response 2018-04-22 09:22:10.984 homeassistant TestAutomation1 response
When I send the following command, I only receive one response:
mosquitto_pub -t test2/test2 -m trigger -h hasstest -V mqttv311
2018-04-22 09:22:13.508 test2/test2 trigger 2018-04-22 09:22:13.548 homeassistant TestAutomation2 response
If I comment out
discovery: true from
configuration.yaml, the behavior reverts to what I would expect - one trigger == one action.