Send sensor data via MQTT

Hello everybody,

I just installed HA with Home assistant and I am currently trying to send data internally via MQTT to the MOSQUITTO Broker. The Add-On is already installed and also the MQTT integration. Furthermore I have several shelly devices and would like to send a message with name, status, etc to the broker.

Is there some way to enable this for all entities?

Best regards,

Yes, its called MQTT Statestream, instructions under MQTT.
For shelly, it might also be possible to do in shelly UI, depends on your device.

Just wanted to say Welcome to the community!

thank you :slight_smile:

Thanks that worked out fine! I now get the shelly information via mqtt to my application!
Is there also a possibility to control this sensors via MQTT?

I tried to write from my application to several topics, but I didn’t work out…but I am pretty sure that the topic or payload was not correct?

Are such things even possible via MQTT or do I have to use the REST api?

Sure there is, you can use them with just the MQTT integration if desired (skipping the Shelly integration)

Yes, you can manually configure them. My Shelly 1PM just uses MQTT as the integration wasn’t very mature when I set it up. Here are a couple of sensors reading info in, and the switch both controlling the relay and reading its state:

    - name: "Immersion switch power"
      unique_id: 44f6d6de-be45-4697-8ff9-882fae91c6a1
      state_topic: "shellies/shelly1pm-XXXXXX/relay/0/power"
      unit_of_measurement: "W"
      device_class: power

    - name: "Immersion switch energy"
      unique_id: f73a2cab-cfb8-4e30-ba54-493de2f1f558
      state_topic: "shellies/shelly1pm-XXXXXX/relay/0/energy"
      unit_of_measurement: "W-min"

    - name: "Immersion switch relay"
      unique_id: 31ba14ba-0c7a-4e2b-9621-92856965edfa
      command_topic: "shellies/shelly1pm-XXXXXX/relay/0/command"
      payload_on: "on"
      payload_off: "off"
      state_topic: "shellies/shelly1pm-XXXXXX/relay/0"
      state_on: "on"
      state_off: "off"

Thank you! That worked out very well :slight_smile: