I have a Tuya alarm clock with CBU module flashed with ESPHome.
It has temp and humidity sensors and a few buttons to control the brightness, volume, etc…
After struggling with ESPHome yaml file for a few hours, now I have a perfectly working clock (except the “alarm” part).
The brightness is defined as “number:” in the yaml file like below,
number:
- platform: tuya
id: brightness
name: "Brightness"
number_datapoint: 101
min_value: 0
max_value: 3
step: 1
This shows up as a slider in ESPHome Web GUI. The brightness changes as I drag the slider and the position of the slider shows the correct brightness instantly.
However, in Home Assistant, the slider does not move at all.
The blue dot of the slider is stuck in the left end (brightness level 0) of the slider but if I click somewhere in the middle of the slider, the brightness of the LED display changes.
If I change the brightness via the slider in ESPHome Web GUI, the change is not reflected to Home Assistant (blue dot is stuck).
I am not sure if this is the problem of ESPHome or Home Assistant.
I tried adding “mode: box” to ESPHome yaml file like below.
number:
- platform: tuya
id: brightness
name: "Brightness"
number_datapoint: 101
mode: box
min_value: 0
max_value: 3
step: 1
Now, the brightness shows up as an input box in Home Assistant and the level of brightness is instantly reflected in Home Assistant.
However, the level of brightness is shown as “1.0”, “2.0”…one decimal…
Contrarily, in ESPHome Web GUI, the brightness is shown as 1, 2, 3…no problem there…
I would like to make the slider move and show correct brightness, OR, the box in Home Assistant shows “1”, “2”, “3”.
Either one is OK with me… Any help would be very much appreciated.