mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 19:26:37 +00:00
HASPmota support for 'buttonmatrix' events (#22898)
This commit is contained in:
parent
95e93b8f33
commit
60570dec76
@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Berry driver for AXP2102 and M5CoreS3 (#22878)
|
- Berry driver for AXP2102 and M5CoreS3 (#22878)
|
||||||
- GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) (#22869)
|
- GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) (#22869)
|
||||||
- LVLG/HASPmota add color names from OpenHASP (#22879)
|
- LVLG/HASPmota add color names from OpenHASP (#22879)
|
||||||
|
- HASPmota support for `buttonmatrix` events
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import sys
|
|||||||
sys.path().push('src/embedded') # allow to import from src/embedded
|
sys.path().push('src/embedded') # allow to import from src/embedded
|
||||||
|
|
||||||
# globals that need to exist to make compilation succeed
|
# globals that need to exist to make compilation succeed
|
||||||
var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,MD5,lv,light_state,udp,tcpclientasync,"
|
var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,MD5,lv,light_state,udp,tcpclientasync,log,"
|
||||||
"lv_clock,lv_clock_icon,lv_signal_arcs,lv_signal_bars,lv_wifi_arcs_icon,lv_wifi_arcs,"
|
"lv_clock,lv_clock_icon,lv_signal_arcs,lv_signal_bars,lv_wifi_arcs_icon,lv_wifi_arcs,"
|
||||||
"lv_wifi_bars_icon,lv_wifi_bars,"
|
"lv_wifi_bars_icon,lv_wifi_bars,"
|
||||||
"_lvgl,"
|
"_lvgl,"
|
||||||
|
@ -683,7 +683,11 @@ class lvh_obj : lvh_root
|
|||||||
if (self._tag != nil)
|
if (self._tag != nil)
|
||||||
tas_event_more += f',"tag":{json.dump(self._tag)}'
|
tas_event_more += f',"tag":{json.dump(self._tag)}'
|
||||||
end
|
end
|
||||||
var tas_event = format('{"hasp":{"p%ib%i":{"event":"%s"%s}}}', self._page._page_id, self.id, event_hasp, tas_event_more)
|
# add sub-index if any
|
||||||
|
var sub_index = self.get_sub_id()
|
||||||
|
var sub_index_str = (sub_index != nil) ? "_" + str(sub_index) : ""
|
||||||
|
|
||||||
|
var tas_event = format('{"hasp":{"p%ib%i%s":{"event":"%s"%s}}}', self._page._page_id, self.id, sub_index_str, event_hasp, tas_event_more)
|
||||||
# print("val=",val)
|
# print("val=",val)
|
||||||
tasmota.set_timer(0, def ()
|
tasmota.set_timer(0, def ()
|
||||||
tasmota.publish_rule(tas_event)
|
tasmota.publish_rule(tas_event)
|
||||||
@ -692,6 +696,13 @@ class lvh_obj : lvh_root
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# `get_sub_id` get any sub_index (only for buttonmatrix currently)
|
||||||
|
#====================================================================
|
||||||
|
def get_sub_id()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
#====================================================================
|
#====================================================================
|
||||||
# `_delete` special attribute used to delete the object
|
# `_delete` special attribute used to delete the object
|
||||||
#====================================================================
|
#====================================================================
|
||||||
@ -2438,6 +2449,18 @@ class lvh_btnmatrix : lvh_obj
|
|||||||
def get_options()
|
def get_options()
|
||||||
return self._options
|
return self._options
|
||||||
end
|
end
|
||||||
|
def get_val()
|
||||||
|
return nil # no 'value' for btnmatrix
|
||||||
|
end
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# `get_sub_id` get any sub_index (only for buttonmatrix currently)
|
||||||
|
#====================================================================
|
||||||
|
def get_sub_id()
|
||||||
|
var btn_idx = self._lv_obj.get_selected_button()
|
||||||
|
return (btn_idx != lv.BUTTONMATRIX_BUTTON_NONE) ? btn_idx : nil
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#====================================================================
|
#====================================================================
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user