I’m looking for a way to control the backlight value of a Nextion display connected to an ESP via ESPHome.
I think I can do it with something like:
it.send_command_printf("dim=%f",id(screen_backlight_value).state);
But I need the entity “screen_backlight_value” to exist in HA before I can do that.
I assume Template Light is the way to go but I see that turn_on/turn_off actions are required and I don’t know what those would be.
Any thoughts?
francisp
(Francis)
October 15, 2020, 5:22am
2
turn_on/turn_off can just be a dummy script.
phileep
(Phil)
October 15, 2020, 5:44am
4
Or you could use an input_number if all you need is a value for brightness
sender
October 15, 2020, 7:29am
5
In esphome config for that nextion I used:
switch:
- platform: uart
name: "nextion.dim1"
data: 'dim=1'
- platform: uart
name: "nextion.dim20"
data: 'dim=20'
- platform: uart
name: "nextion.dim100"
data: 'dim=100'
- platform: uart
name: "nextion.dimsave"
data: [0xFF, 0xFF, 0xFF]
This way I have 4 switches in hass and via node red I set (just a example):