Hi all together,
since the ESPHome and HA support new entities and components with the new update, I’m especially interested in ESPHome’s number component.
That’s my code:
globals:
# This variable stores the current mode chosen by pressing the buttons (physical or digital)
- id: totalClick
type: int
restore_value: no
initial_value: "0"
sensor:
# This sensor only displays the current mode chosen by pressing one of the buttons (digital or physical button)
- platform: template
id: buttonClickSensor
name: "esp01s01_buttonClickSensor"
update_interval: 0.5s
accuracy_decimals: 0
#unit_of_measurement: "clk"
lambda: return id(totalClick);
number:
- platform: template
name: "esp01s01_mode_slider"
id: "modeSlider"
step: 1
min_value: 0
max_value: 3
mode: slider
set_action:
then:
- lambda: id(totalClick) = x;
button:
# This is the digital button which is the equivalent of the physical button
- platform: template
name: "esp01s01_publicButton"
id: "publicButton"
on_press:
- lambda: |-
id(totalClick)++;
if( id(totalClick) > 3 ) id(totalClick) = 0;
- switch.turn_on: ssrLogicMain
That’s the fronend view:
What is happening (working properly):
- Clicking the
publicButton
changes the value ofbuttonClickSensor
(each press increments the value by 1; if it is greater than 3, it’s getting reset to 0), marked in RED - Changing the
mode_slider
changes the value ofbuttonClickSensor
, marked in GREEN
What is not happening yet:
- Clicking the
publicButton
changes the value ofmode_slider
, YELLOW ARROW - Changing the
mode_slider
or clicking thepublicButton
shows the current value next to themode_slider
, YELLOW CIRCLE => if it would work it could replace thebuttonClickSensor
Can someone tell me how to reach that with the “externally” changed mode_slider
?
I tried various combinations including on_value... set.number: ....
, but nothing worked.