How do I get hass.io to publish DarkSky humidity to Mosquitto

2 weeks in with hass.io - waiting for a bunch of Sonoffs and trying to figure “it all” out.

So - I got Mosquitto up and running on the same Pi as Hass.io is on. I tested it with MQTT.fx - so far so good.

Now, I set up DarkSky also, and I get DarkSky data in.

But how to I set up Hass.io to publish DarkSky humidity to MQTT? at given time intervals or whenever the state/value changes

I found someone talking about a Service called mqtt.publish, but I cannot find it under Services… lost…:frowning:

Take a look here:

Thanks VDRainer - will do.

I took another route - got it done in the Node-Red add-on for Hass.io - with some help from the Node-Red Slack community

Seeing as I pretty much did this last night (albeit with a different sensor), I thought I might as well put it on here for others anyway :slight_smile:

Create an automation as follows, and everytime the state of the sensor (the value in this case) changes, it will trigger and publish to the MQTT topic:

- alias: 'bathroom humidity'
  trigger:
    platform: state
    entity_id: sensor.bathroom_humidity
  action:
    service: mqtt.publish
    data_template:
      topic: 'homeassistant/sensor/bathroom/humidity'
      payload_template: '{{states.sensor.bathroom_humidity.state}}'

You’ll have to change the entity_id for the trigger, to that of the Darksky humidity sensor, then set the topic in the action to whatever topic you wish to publish to. Lastly, change the payload_template to match the Darksky humidity sensor.

I’m using the above to push the humidity reading from one Home Assistant install, to another via MQTT. That way I have have a “live” system and a development system using the same sensor names and values.