It works, but it looks really bad. Is there a way to transfer the input_select state using return id(pages) without using if - else?
P.S. sorry for my English, it is not my native language
And if there are 20, 30, 40 pages? Then write 3 lines of code for each? It doesn’t seem logical to me. Is there really no mechanism to transfer the state of the sensor directly?
I want to do something very similar (define the to-be-shown display page through MQTT) and have the same problem. The error message says that it received a string (“page1”), but expected the type DisplayPage. Now if there were a way to convert (“cast”) a string into the DisplayPage type, then the problem would be easily solvable. I didn’t find anything yet, though.
Hey,
I am trying to do exactly what you did here (using Input_select to change the pages on my OLED screen).
I copy pasted your code to my ESPhome but it keeps failing. not sure why.
can you past your exact code you’ve used for your ESPhome here?
Thanks