I’ve got myself a couple of Guition 4848S040 displays and fairly quickly got OpenHasp working on one with screen buttons able to control lights and cover in HA.
I then tried to do the same with Tasmota and although I got stuff on the display, got nowhere trying to link to HA!
I’m now trying with ESPHome. I’ve loaded the example code given for the Guition display found here.
I don’t know a lot about ESPHome and am having trouble finding an example of linking a simple on/off light (light.light_switch_lounge_main) already in HA to the button in the sample code (lv_button_1).
but whilst it validates ok, it fails to compile with the error:
/config/esphome/display-4848s040.yaml: In lambda function:
/config/esphome/display-4848s040.yaml:141:14: error: 'Lounge_Main_Light' was not declared in this scope
141 | lambda: 'return Lounge_Main_Light.state = "on";'
| ^~~~~~~~~~~~~~~~~
Maybe I’m trying to use it before it’s fully defined!
And lastly, this snippet creates the internal_light and sets up the actions when the screen button is pressed. Apparently, I should be using action terminology as services have been renamed as such in HA, but I just copied a real life example I found in the forum rather than those cryptic examples given in the docs!
I say it ‘almost works’ because it reacts properly when the light is turned on/ff in HA and when turned on/off with the button in ESPHome. Except when turned on in HA and the off from ESPHome. In that case the button shows it as having gone off but the light stays on. A second press briefly brings the button light back on but the actual light does go off followed by the button light. Does that make sense?
This is what I copied for my display and it works fine. The use of lambda for state checking is not something I would normally do either, but it works.