Skip to content

homebridge2ESP8266

cflurin edited this page Feb 14, 2017 · 2 revisions

This example demonstrates a communication between an ESP8266 with a Temperature Sensor ds18b20 and homebridge-mqtt.

  • Install ESP Easy, Build 108 or newer.

  • Open ESP Easy and add a Device:

Device: Temperature - DS18b20
Name: esp18b20
Delay: 300
Value Name 1: temperature

Note: the temperature value is sent with an interval of 300 seconds, change the setting as required.

  • Go to Tools/Advanced and check the Rules checkbox, to enable Rules.

  • Open the tab Rules and add this code:

on ds18b20#temperature do
  Publish homebridge/to/set,{"name":"esp_temp","characteristic":"CurrentTemperature","value":[ds18b20#temperature]}
endon
  • Add the accessory to homebridge-mqtt e.g. with node-red:
topic: homebridge/to/add
payload: {"name":"esp_temp","service":"TemperatureSensor"}

or use mosquitto_pub:

mosquitto_pub -h 127.0.0.1 -t homebridge/to/add -m '{"name":"esp_temp","service":"TemperatureSensor"}'

Replace 127.0.0.1 with the ip-address of your mqtt broker.

Clone this wiki locally