I received a Sonoff NSPanel last night and have diligently bumbled through creating a custom 3x3 button grid to match a corresponding Lovelace dashboard.
Following this video I have all the buttons registering in HA.
Goal: I would like each of these dual-state Nextion buttons to correspond to HA entities (either switch or light domains) while following ON or OFF state in HA.
This is where I am coming up short. Looking through ESPHome docs it should support a set_state lamba call but this won’t compile. I am far beyond my depth and any guidance is appreciated.
Compiling /data/nspanel/.pioenvs/nspanel/src/main.cpp.o
/config/esphome/nspanel.yaml: In lambda function:
/config/esphome/nspanel.yaml:89:14: error: 'class esphome::nextion::Nextion' has no member named 'set_state'
id(disp1).set_state(state)
^
lol, spend far too much time banging my head on the wall trying all manner of combinations (below). Only to be fooled by letter case; doh! I don’t code, haha. But now changing the state of a light/switch in HA reflects in the icon (pic) value of the NSPanel. Yay!
Did you find a resolution to your issue of synchronising the switch states with the NSPanel? I am in the same position now, I have a switch on my screen that controls a light in home assistant, but setting the state on boot to match what it is in Home Assistant without actually triggering the switch itself is a hurdle I am yet to overcome.
Also, of the different combinations you included above, which one was it that worked in your case?