I have recently installed HA Yellow, Home Assistant 2023.10.5 Supervisor 2023.11.3 Operating System 11.1 Frontend 20231005.0 - latest .
I have one device integrated - a thermostat. In device info, the thermostat offers 8 sensors.
I would like to send those sensor values out as an MQTT message when one of them changes.
I have installed the Mosquitto MQTT server in HA. which will replace a standalone Raspberry Pi Mosquitto MQTT broker that I was using prior to HA. I have an existing MQTT client that can subscribe to topics and stores the data into a PostgreSQL database.
I see from the Device page I can add Automations. I can trigger to “Do something when… T6 Pro Indoor temperature temperature changes”.
I can Add Action to Call a service.
I can change Actions to "Call a service ‘MQTT: Publish’ "
I can select Payload or Payload template. The field appears to be a string. It is unclear how the appropriate sensor value is included into that string. It can’t be hardcoded.
My Actions editor looks like this:
I found this article that talks about Notification services for MQTT
The Actions configuration from the example looks like this:
I don’t understand how what I see above on the devices automation actions relates to the statement “Call Service section from Developer Tools → Services allows you to send MQTT messages. Choose mqtt.publish from the list of Available services: and enter something like the sample below into the Service Data field and hit CALL SERVICE.”
If I configure mqtt.publish globally, how is unique data included into payloads from various devices? I went to that service page, and it looks identical to the automation action above.
Side question: If I try to save my partial automation I get “Message malformed: must contain at least one of below, above.” I found out it requires a fixed temperature threshold. I want the message sent with any change, not a threshold.