mirror of https://github.com/arendst/Tasmota.git
let berry drivers provide "after_teleperiod" handlers (#21351)
this is useful if you want to periodically report the state of something handled separately to the sensors output.
This commit is contained in:
parent
c41f18a9b6
commit
cced3d1d93
|
@ -14,6 +14,7 @@ class Driver
|
|||
var save_before_restart
|
||||
var web_sensor
|
||||
var json_append
|
||||
var after_teleperiod
|
||||
var button_pressed
|
||||
var display
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ be_local_closure(Driver_add_cmd, /* name */
|
|||
** Solidified class: Driver
|
||||
********************************************************************/
|
||||
be_local_class(Driver,
|
||||
13,
|
||||
14,
|
||||
NULL,
|
||||
be_nested_map(14,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
|
@ -87,6 +87,7 @@ be_local_class(Driver,
|
|||
{ be_const_key(web_add_management_button, 0), be_const_var(5) },
|
||||
{ be_const_key(every_100ms, 13), be_const_var(1) },
|
||||
{ be_const_key(json_append, -1), be_const_var(10) },
|
||||
{ be_const_key(after_teleperiod, -1), be_const_var(13) },
|
||||
{ be_const_key(web_add_button, -1), be_const_var(3) },
|
||||
})),
|
||||
(bstring*) &be_const_str_Driver
|
||||
|
|
|
@ -985,6 +985,9 @@ bool Xdrv52(uint32_t function)
|
|||
case FUNC_JSON_APPEND:
|
||||
callBerryEventDispatcher(PSTR("json_append"), nullptr, 0, nullptr);
|
||||
break;
|
||||
case FUNC_AFTER_TELEPERIOD:
|
||||
callBerryEventDispatcher(PSTR("after_teleperiod"), nullptr, 0, nullptr);
|
||||
break;
|
||||
|
||||
case FUNC_BUTTON_PRESSED:
|
||||
callBerryEventDispatcher(PSTR("button_pressed"), nullptr, 0, nullptr);
|
||||
|
|
Loading…
Reference in New Issue