HomeAssistant + NodeMCU

Hello Guys,

I want to have a switch in my HA States that publish a mqtt message (0, 1) to all the subscribers.
I 've already done this with the following code:

- action:
  - data:
      payload: '0'
      qos: 0
      retain: 0
      topic: mathistest
    service: mqtt.publish
  alias: New Automation
  condition: []
  id: '1504780813293'
  trigger:
  - entity_id: switch.test1
    from: '0'
    platform: state
    to: '1'

On my NodeMCU I have to set the mqtt broker - what is the mqtt broker then? The IP from my HomeAssistant Server?

Hi @mathishuettl,

Where do you have installed HA? Where do you have it installed mosquitto broker?

Depend on the replies taht you will give, then it’s possible to put the same IP or different ones.

thanks

1 Like

Now everthing works fine i think, just one problem:

I installed HA and mosquitto on a virtualbox ubuntu installation.
HomeAssistant can perfect connect to mosquitto.

But why i want to connect to my mqtt broker with my nodemcu it fails… i use the pubsubclient esp8266 example …

Hi @mathishuettl, if you want to connect to a Virtualbox VM from your network, you have to use a ‘Bridged’ network adapter in the VM.

1 Like