esphome/esphome-docs

Cookbook: adafruit.io MQTT

hajdbo opened this issue · 1 comments

I could not find an esphomeyaml template that would work with adafruit.io: auto-generated MQTT topics would not be accepted by adafruit.io, and debug messages would go over the 30 msg/min rate limit.
To work around these problems, I had to:

  • Remove the birth_message and will_message, because they would spam the console every five seconds,
  • Remove the OTA debug stream, as it would also go over the rate limit. You can still upload new firmwares OTA, though.
  • Force adafruit.io MQTT topic naming convention for each sensor output.

Here is the template, for you to reuse. Replace XXXX by your user name, of course.

esphomeyaml:
  name: mqttbme280
  platform: ESP8266
  board: nodemcuv2
wifi:
    ssid: 'XXXXXXX'
    password: 'XXXXXXXXXXXXXXXX'
ota:
  password: 'XXXXXXXXXXXXXXXX'
mqtt:
  broker: 'io.adafruit.com'
  username: 'XX<USERNAME>XX'
  password: 'XX<APIKEY>XX'
  topic_prefix: 'XX<USERNAME>XX/feeds'
  birth_message:
  will_message:
  log_topic:
# Enable verbose logging on serial
logger:
    level: VERY_VERBOSE
    logs:
         spi: INFO
         i2c: INFO
i2c:
  sda: D6
  scl: D5
  scan: False
binary_sensor:
    - platform: status
      name: "BME280 Status"
      id: status
      internal: True
# note that bme280 is either on address 0x77 or 0x76
sensor:
  - platform: bme280
    address: 0x76
    temperature:
      name: "BME280 Temperature"
      id: temperature
      state_topic: XX<USERNAME>XX/feeds/bme280.temperature
      discovery: False
      filters: []
    pressure:
      name: "BME280 Pressure"
      id: pressure
      state_topic: XX<USERNAME>XX/feeds/bme280.pressure
      discovery: False
      filters: []
    humidity:
      name: "BME280 Humidity"
      id: humidity
      state_topic: XX<USERNAME>XX/feeds/bme280.humidity
      discovery: False
      filters: []
    update_interval: 15s
- platform: wifi_signal
    name: "BME280 WiFi Signal"
    update_interval: 15s
    id: signal
    state_topic: XX<USERNAME>XX/feeds/bme280.wifi
    filters: []
    discovery: False
switch:
  - platform: restart
    name: "BME280 Restart"
    internal: True