Usage - ilikecake/ESP32-Wall-Display GitHub Wiki

By default, the device will display the remote sensor readings on the display for a set amount of time and then blank the display to conserve the OLED display. If you set up the '_DisplayShouldBeOn' function, whenever that function returns true, the display will stay on.

Buttons

When the display is blanked, pressing either button will wake the display and show the remote sensor readings.

When the display is on:

  • The top button will switch the display to show the remote sensor reading.
  • The bottom button will toggle between showing the local sensor readings from the BME280 sensor and showing a status screen with device info.
  • Both buttons will report a button press to home assistant

There is a small hole below the two buttons that provides access to the reset button of the device. Stick a paperclip or other thin object in here to hard reset the device.

Home Assistant Interface

The device uses MQTT discovery to configure Home Assistant without you having to do anything. It will show up on the list of devices.

The entities can be configured and used for whatever you want from there.

Button presses are sent to Home Assistant as MQTT Device Triggers. They are referred to as 'Upper Button' and 'Lower Button'.

The RGB LED will listen to MQTT messages on the topic defined in secrets.py. An RGB LED should be defined in Home Assistant similar to below.

    - name: "Status RGB LED"
      state_topic: "home/status/light/status"
      command_topic: "home/status/light/switch"
      brightness_state_topic: "home/status/brightness/status"
      brightness_command_topic: "home/status/brightness/set"
      rgb_state_topic: "home/status/rgb/status"
      rgb_command_topic: "home/status/rgb/set"
      state_value_template: "{{ value_json.state }}"
      brightness_value_template: "{{ value_json.brightness }}"
      rgb_value_template: "{{ value_json.rgb | join(',') }}"
      qos: 0
      payload_on: "ON"
      payload_off: "OFF"
      optimistic: true
      retain: true

In the above code, the 'device_status_topic' is 'home/status/'. Any change to the state of this RGB LED will be mirrored by the pixel on the device.

Error handling

The device should be able to gracefully handle various errors. When an error is encountered, the RGB LED will be used to indicate the error. The OLED should also give more details on the error.

Loss of wifi

The device should retry the wifi connection 200 times approximately ever 30 seconds. If it cannot connect after 200 tries, it will hard reboot the device.

The RGB LED will be red when attempting to connect to wifi.

No connection to MQTT broker

If the device cannot connect to the MQTT broker, it will retry 200 times approximately every 30 seconds. If it still cannot connect after 200 tries, it will hard reboot the device.

The RGB LED will be blue when attempting to connect to the MQTT broker.

No connection to NTP server

The device gets the time from a NTP server. The default server it uses is '0.adafruit.pool.ntp.org'. If this server is not available, the device will continue to function. If no valid time was found, it will try about every 30 minutes to connect and get the time. If a valid time was obtained from NTP, it will try to update the time about every 24 hours.

The RGB LED will be white when trying to get time from NTP.