mirror of https://github.com/arendst/Tasmota.git
HASPmota add 'tag' attribute for free-form JSON (#22698)
This commit is contained in:
parent
27e85809b5
commit
3b48a1c16a
|
@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- TLS disable ECDSA for MQTT to ensure we don't break fingerprints after #22649
|
- TLS disable ECDSA for MQTT to ensure we don't break fingerprints after #22649
|
||||||
- GPIOViewer from v1.5.6 to v1.5.8
|
- GPIOViewer from v1.5.6 to v1.5.8
|
||||||
- HASPmota use 'roboto.ttf' for automatic sizing of default font
|
- HASPmota use 'roboto.ttf' for automatic sizing of default font
|
||||||
|
- HASPmota add 'tag' attribute for free-form JSON
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Berry Zigbee fix wrong attributes (#22684)
|
- Berry Zigbee fix wrong attributes (#22684)
|
||||||
|
|
|
@ -86,6 +86,8 @@ class lvh_root
|
||||||
var _parent_lvh # parent HASPmota object if 'parentid' was set, or 'nil'
|
var _parent_lvh # parent HASPmota object if 'parentid' was set, or 'nil'
|
||||||
var _meta # free form metadata
|
var _meta # free form metadata
|
||||||
|
|
||||||
|
var _tag # free-form JSON tag
|
||||||
|
|
||||||
#====================================================================
|
#====================================================================
|
||||||
# Rule engine to map value and text to rules
|
# Rule engine to map value and text to rules
|
||||||
# hence enabling auto-updates ob objects
|
# hence enabling auto-updates ob objects
|
||||||
|
@ -313,6 +315,16 @@ class lvh_root
|
||||||
return self._lv_obj
|
return self._lv_obj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# set_tag: create a free-form JSON tag
|
||||||
|
#====================================================================
|
||||||
|
def set_tag(t)
|
||||||
|
self._tag = t
|
||||||
|
end
|
||||||
|
def get_tag()
|
||||||
|
return self._tag
|
||||||
|
end
|
||||||
|
|
||||||
#====================================================================
|
#====================================================================
|
||||||
# set_text: create a `lv_label` sub object to the current object
|
# set_text: create a `lv_label` sub object to the current object
|
||||||
# (default case, may be overriden by object that directly take text)
|
# (default case, may be overriden by object that directly take text)
|
||||||
|
@ -667,9 +679,16 @@ class lvh_obj : lvh_root
|
||||||
tas_event_more += f',"text":{json.dump(text)}'
|
tas_event_more += f',"text":{json.dump(text)}'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# add tag if present
|
||||||
|
if (self._tag != nil)
|
||||||
|
tas_event_more += f',"tag":{json.dump(self._tag)}'
|
||||||
|
end
|
||||||
var tas_event = format('{"hasp":{"p%ib%i":{"event":"%s"%s}}}', self._page._page_id, self.id, event_hasp, tas_event_more)
|
var tas_event = format('{"hasp":{"p%ib%i":{"event":"%s"%s}}}', self._page._page_id, self.id, event_hasp, tas_event_more)
|
||||||
# print("val=",val)
|
# print("val=",val)
|
||||||
tasmota.set_timer(0, /-> tasmota.publish_rule(tas_event))
|
tasmota.set_timer(0, def ()
|
||||||
|
tasmota.publish_rule(tas_event)
|
||||||
|
tasmota.log(f"HSP: publish {tas_event}", 4)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue