mqtt-bme280-homie icon indicating copy to clipboard operation
mqtt-bme280-homie copied to clipboard

Make OLED display work without wifi connection

Open rradar opened this issue 7 years ago • 2 comments

In my setup the display only works when there is a active wifi connection.

Would be nice to get a "offline" mode (probably without time and network stats) :+1:

rradar avatar Aug 01 '18 08:08 rradar

@rradar feel free to create a PR :-) I think it should be possible, the main challenge might be related to Homie because this does all initialization, network & MQTT connect first. But it might be possible to use in offline mode as well.

mhaack avatar Aug 02 '18 07:08 mhaack

hey @mhaack I tried to build with homie but because I'm lacking any serious coding skills I failed silently.

But I did somehow rebuild your idea with the great esphomeyaml https://github.com/OttoWinter/esphomeyaml by @OttoWinter

It's working (right now with a BMP180 - so without humidity for now) including mqtt (with auto discovery for home assistant) and working OLED display - even when offline :smile:

What's actually missing is your really nice and perfectly oled optimized screen animations, layout and icon set. Are you interested to contribute your work for this "mind fork"? :slightly_smiling_face:

here is my mqtt-bmp180-oled.yaml for a ESP-M3 (but works with all esp8266 and esp32 if you just edit platform/board and i2c ports in the sketch)

esphomeyaml:
  name: mqtt-bmp180-oled
  platform: ESP8266
  board: esp8288

wifi:
  ssid: 'xxx'
  password: 'xxx'

mqtt:
  broker: 'xxx'
  username: 'xxx'
  password: 'xxx'

# Enable logging
logger:

ota:
  password: 'xxx'

i2c:
  sda: 0
  scl: 2
  scan: False

binary_sensor:
  - platform: status
    name: "mqtt-bmp180-oled Status"
    id: status

sensor:
  - platform: wifi_signal
    name: "mqtt-bmp180-oled WiFi Signal"
    update_interval: 60s
    id: signal

  - platform: bmp085
    temperature:
      name: "mqtt-bmp180-oled Temperature"
      id: temperature
    pressure:
      name: "mqtt-bmp180-oled Pressure"
      id: pressure
    update_interval: 60s

switch:
  - platform: restart
    name: "mqtt-bmp180-oled Restart"

font:
  - file: "five.ttf"
    id: five8
    size: 8

time:
  - platform: sntp
    id: time
    servers:
      - 0.pool.ntp.org

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda:  |-
      it.printf(0, 10, id(five8), "Temp: %.1f Celsius", id(temperature).value);
      it.printf(0, 20, id(five8), "Pressure: %.1f hPa", id(pressure).value);
      it.strftime(0, 35, id(five8), "Time: %H:%M", id(time).now());
      it.strftime(0, 45, id(five8), "Date: %d.%m.%Y", id(time).now());
      it.printf(0, 60, id(five8), "Wifi: %s", id(status).value ? "Online" : "Offline");
      it.printf(80, 60, id(five8), "%.1f", id(signal).value);

Looks like this:

image

rradar avatar Oct 23 '18 16:10 rradar