Hello
Can someone help me please
This code worked fine.
But i want to switch the pages with a gpio button/switch but i dont know why.
I tryd many things but nothing worked. My las try was:
globals:
- id: current_page_num
type: int
restore_value: no
initial_value: '1'
display:
- platform: lcd_pcf8574
dimensions: 20x4
address: 0x27
id: my_display
update_interval: 10s
lambda: |-
if (id(current_page_num) == 1) {
it.strftime("It is %H:%M on %d.%m.%Y", id(my_time).now());
}
if (id(current_page_num) == 2) {
it.printf(0, 0, "%s", id(IP).state.c_str());
it.printf(0, 1, "%s", id(ssid).state.c_str());
it.printf(10, 1, "%.0f dBm", id(wlan_signal).state);
it.printf(0, 3, "%s", id(uptime_human).state.c_str());
}
if (id(current_page_num) == 3) {
it.printf(0, 0, "%.0f Watt", id(Watt).state);
it.printf(0, 1, "%.0f Ampere", id(Ambere).state);
it.printf(0, 2, "%.0f Volt", id(Volt).state);
it.printf(0, 3, "%.0f kWh", id(kWhTotal).state);
button:
- platform: gpio
pin: D5
name: Button
id: Button
on_press:
- lambda: |-
current_page_num += 1;
if (current_page_num > 3) {
current_page_num = 1;
}
return (id(current_page_num).state)
TNX in advance