Berry script adding a button to the configuration menu works but event isn´t working #18753
Replies: 8 comments 13 replies
-
From what I can see, using Maybe @s-hadinger can suggest how configuration page buttons are supposed to work? Looking for pertinent callback, I did not spot a good candidate... It did not work in |
Beta Was this translation helpful? Give feedback.
-
For the configuration page, you need to define an HTML form. Example from Matter UI: def web_add_config_button()
import webserver
webserver.content_send("<p><form id=ac action='matterc' style='display: block;' method='get'><button>Configure Matter</button></form></p>")
end You also need to register to the sub-url: #- ---------------------------------------------------------------------- -#
# respond to web_add_handler() event to register web listeners
#- ---------------------------------------------------------------------- -#
#- this is called at Tasmota start-up, as soon as Wifi/Eth is up and web server running -#
def web_add_handler()
import webserver
#- we need to register a closure, not just a function, that captures the current instance -#
webserver.on("/matterc", / -> self.page_part_mgr(), webserver.HTTP_GET)
webserver.on("/matterc", / -> self.page_part_ctl(), webserver.HTTP_POST)
end |
Beta Was this translation helpful? Give feedback.
-
Could you please provide a complete but simple working example? |
Beta Was this translation helpful? Give feedback.
-
Thank you very much! I found another simple example: web_handler_demo. It works if I upload the code to the Berry Scripting console. |
Beta Was this translation helpful? Give feedback.
-
Ok, it works. I want to use cyclic function to get data using webclient class. |
Beta Was this translation helpful? Give feedback.
-
Thanks again, but I still get some timeouts. After |
Beta Was this translation helpful? Give feedback.
-
Sorry that I didn´t explain exactly what I´m going to do. I want to collect some data from other devices (e.g. OpenDTU which gets data from my solar inverter).
By the way: what does If I insert the same code to the Berry Scripting console there is no error! |
Beta Was this translation helpful? Give feedback.
-
I´m sorry, I noticed that you mentioned the triggers but it´s not easy for a beginner in Tasmota to understand how everything works. Ok, you´re right. I try to be more precise instead of talking about "doesn´t work". |
Beta Was this translation helpful? Give feedback.
-
PROBLEM DESCRIPTION
I want to have an additional button in the config menu.
Therefore I tried the example Adding a button to the Main menu.
The button is visible in the config menu. But if I press the button nothing happens (no output in the log).
The button in the main menu works as expected.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log:TO REPRODUCE
EXPECTED BEHAVIOUR
"config button pressed" visible in the log.
SCREENSHOTS
ADDITIONAL CONTEXT
(Please, remember to close the issue when the problem has been addressed)
Beta Was this translation helpful? Give feedback.
All reactions