Auto forward all temperature sensors and IoT events to MQTT

Hi there - hopefully a quick question which might exist in documents somewhere. I’ve tried looking already but not entirely sure of what to search for.

Hoping someone can help.

I have a bunch of devices connected to HomeAssistant. Primarily Tuya smart bulbs, switches and Xaiomi temperature sensors.

I have configured MQTT broker.

I also have a separate InfluxDB set up which captures weather sensors from an outside weather stations.

I’m interested to see if I can configure devices to easily auto forward state changes onto the MQTT broker so that I can ingest them into InfluxDB and chart them over time.

One specific example: I have a dumb oil heater connected through a Tuya smart switch. I also have a Xaiomi temperature sensor in the room. I have automations set up to turn the heater on below a certain temperature and off when it goes above.

I’d love to:
a) Record the temperature from the sensor into MQTT
b) Record the state change of the switch (on/off)
So that I can see how often it is triggered and the effects of it over time.

I’m sure I can set up what I need for each sensor, but my question is “Is there an easy way to configure it to auto publish state changes of all sensors to MQTT topics based on a template?”

Thanks in advance

Do you actually want to use MQTT, or forward to influxdb?
If you just to forward values to influxdb, the integration does just that:

1 Like

Amazing! I feel like a bit of an idiot. I didn’t think to see if there was a way to send directly.

I’ll give it a try. I do have some switches that I want to track the state change for, and note that it seems that this may not be supported.

But I’ll see how I go after giving it a try.

Thank you!