esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
293 stars 36 forks source link

ssd1036 refresh screen on status change? #3626

Open FinestDice17 opened 2 years ago

FinestDice17 commented 2 years ago

The problem

So currently this code works fine, outside of the update interval being an issue sense I'm running this on battery. Is there a way to have the screen update on status change only? Im using it as a screen that monitors a selector with states of my dishwasher. when it changes, i have it sending that status over to the esp32 board via mqtt.

Which version of ESPHome has the issue?

2022.9.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

Home Assistant 2022.9.7 Supervisor 2022.09.1 Operating System 9.0 Frontend 20220907.2 - latest

What platform are you using?

ESP32

Board

heltec

Component causing the issue

i2c

Example YAML snippet

esphome:
  name: dishwasher-oled

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "secret_api_key"

ota:
  password: "secret_password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Dishwasher-Oled Fallback Hotspot"
    password: "vyv4fCpB9gTh"

captive_portal:

mqtt:
  broker: 192.168.1.41
  username: mqtt-user
  password: !secret mqtt_password

text_sensor:
  - platform: mqtt_subscribe
    name: "Data from topic"
    id: dishwasherstate
    topic: the/topic
i2c:
    sda: 4
    scl: 15
    scan: false

display:
  - platform: ssd1306_i2c
    id: oled
    update_interval: 1min
    contrast: 0.4
    model: "SH1106 128x64"
    reset_pin: 16
    #rotation: 180
    address: 0x3C
    lambda: |-
      // Print "<state>" in center
      it.printf(59, 23, id(segoe), TextAlign::CENTER, id(dishwasherstate).state.c_str());

sensor:  
  - platform: homeassistant
    id: dishwasher_state
    entity_id: input_select.dishwasher_current_state
    internal: true

time:
- platform: homeassistant
  id: esptime

font:
  - file: "_fonts/nasalization.ttf"
    id: font1
    size: 12
  - file: "_fonts/AmaticSC.ttf"
    id: font2
    size: 12
  - file: "_fonts/refsan.ttf"
    id: font3
    size: 13
  - file: "segoeui.ttf"
    id: segoe
    size: 30

button:
  - platform: restart
    name: dishwasher oled

light:
  - platform: status_led
    name: "Switch state"
    pin: GPIO2
``

Anything in the logs that might be useful for us?

No response

Additional information

No response

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.