From 57cf29c2fd84588b07b8c7c0acc888433964470b Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:09:22 -0800 Subject: [PATCH] Matter improve `MtrInfo` (#20686) --- CHANGELOG.md | 1 + .../src/embedded/Matter_Plugin_1_Device.be | 8 + .../src/embedded/Matter_Plugin_2_Sensor.be | 10 - .../Matter_Plugin_2_Sensor_Contact.be | 9 - .../Matter_Plugin_2_Sensor_Occupancy.be | 9 - .../embedded/Matter_Plugin_2_Sensor_OnOff.be | 2 + .../solidified_Matter_Plugin_1_Device.h | 172 ++++--- .../solidified_Matter_Plugin_2_Sensor.h | 434 ++++++++---------- ...olidified_Matter_Plugin_2_Sensor_Contact.h | 288 +++++------- ...idified_Matter_Plugin_2_Sensor_Occupancy.h | 280 +++++------ 10 files changed, 560 insertions(+), 653 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 348be9510..bfb1f718f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - ESP32 LVGL library from v8.3.11 to v9.0.0, some small breaking changes in C, none in HASPmota (#20659) ### Changed +- Matter improve `MtrInfo` ### Fixed diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be index 8ddf9012b..4357a3844 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be @@ -178,6 +178,7 @@ class Matter_Plugin_Device : Matter_Plugin # New values need to be appended with `,"key":value` (including prefix comma) def append_state_json() import introspect + import json var ret = "" # ret: string @@ -193,6 +194,13 @@ class Matter_Plugin_Device : Matter_Plugin end end + # If sensor with JSON_NAME using `val` + var json_name = introspect.get(self, 'JSON_NAME') + if json_name && introspect.contains(self, 'shadow_value') + var val = (self.shadow_value != nil) ? json.dump(self.shadow_value) : "null" + ret += f',"{json_name}":{val}' + end + # lights # print(f'{self=} {type(self)} {introspect.members(self)=}') _stats_json_inner("shadow_onoff", "Power") diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be index 1678f2a4f..a702a11af 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be @@ -106,15 +106,5 @@ class Matter_Plugin_Sensor : Matter_Plugin_Device super(self).update_virtual(payload_json) end - ############################################################# - # append_state_json - # - # Output the current state in JSON - # New values need to be appended with `,"key":value` (including prefix comma) - def append_state_json() - var val = (self.shadow_value != nil) ? self.shadow_value : "null" - return f',"{self.JSON_NAME}":{val}' - end - end matter.Plugin_Sensor = Matter_Plugin_Sensor diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Contact.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Contact.be index f560d9540..fbd061b1f 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Contact.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Contact.be @@ -119,14 +119,5 @@ class Matter_Plugin_Sensor_Contact : Matter_Plugin_Device super(self).update_virtual(payload_json) end - ############################################################# - # append_state_json - # - # Output the current state in JSON - # New values need to be appended with `,"key":value` (including prefix comma) - def append_state_json() - return f',"Contact":{int(self.shadow_contact)}' - end - end matter.Plugin_Sensor_Contact = Matter_Plugin_Sensor_Contact diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Occupancy.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Occupancy.be index 8ad690726..958386d59 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Occupancy.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Occupancy.be @@ -123,14 +123,5 @@ class Matter_Plugin_Sensor_Occupancy : Matter_Plugin_Device super(self).update_virtual(payload_json) end - ############################################################# - # append_state_json - # - # Output the current state in JSON - # New values need to be appended with `,"key":value` (including prefix comma) - def append_state_json() - return f',"Occupancy":{int(self.shadow_occupancy)}' - end - end matter.Plugin_Sensor_Occupancy = Matter_Plugin_Sensor_Occupancy diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_OnOff.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_OnOff.be index b7b1eb758..ce535f91c 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_OnOff.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_OnOff.be @@ -95,6 +95,8 @@ class Matter_Plugin_Sensor_OnOff : Matter_Plugin_Device # # Output the current state in JSON # New values need to be appended with `,"key":value` (including prefix comma) + # + # Override the default behavior to use the key `OnOff` instead of `Power` def append_state_json() return f',"OnOff":{int(self.shadow_onoff)}' end diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Device.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Device.h index 71adb3df2..f93586d65 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Device.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Device.h @@ -326,7 +326,7 @@ be_local_closure(Matter_Plugin_Device_read_attribute, /* name */ ********************************************************************/ be_local_closure(Matter_Plugin_Device_append_state_json, /* name */ be_nested_proto( - 7, /* nstack */ + 11, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -340,7 +340,7 @@ be_local_closure(Matter_Plugin_Device_append_state_json, /* name */ 1, /* has upvals */ ( &(const bupvaldesc[ 2]) { /* upvals */ be_local_const_upval(1, 0), - be_local_const_upval(1, 2), + be_local_const_upval(1, 3), }), 0, /* has sup protos */ NULL, /* no sub protos */ @@ -391,78 +391,112 @@ be_local_closure(Matter_Plugin_Device_append_state_json, /* name */ ), }), 1, /* has constants */ - ( &(const bvalue[22]) { /* constants */ + ( &(const bvalue[30]) { /* constants */ /* K0 */ be_nested_str_weak(introspect), - /* K1 */ be_nested_str_weak(), - /* K2 */ be_nested_str_weak(shadow_onoff), - /* K3 */ be_nested_str_weak(Power), - /* K4 */ be_nested_str_weak(shadow_bri), - /* K5 */ be_nested_str_weak(Bri), - /* K6 */ be_nested_str_weak(shadow_ct), - /* K7 */ be_nested_str_weak(CT), - /* K8 */ be_nested_str_weak(shadow_hue), - /* K9 */ be_nested_str_weak(Hue), - /* K10 */ be_nested_str_weak(shadow_sat), - /* K11 */ be_nested_str_weak(Sat), - /* K12 */ be_nested_str_weak(shadow_shutter_pos), - /* K13 */ be_nested_str_weak(ShutterPos), - /* K14 */ be_nested_str_weak(shadow_shutter_target), - /* K15 */ be_nested_str_weak(ShutterTarget), - /* K16 */ be_nested_str_weak(shadow_shutter_tilt), - /* K17 */ be_nested_str_weak(ShutterTilt), - /* K18 */ be_nested_str_weak(shadow_contact), - /* K19 */ be_nested_str_weak(Contact), - /* K20 */ be_nested_str_weak(shadow_occupancy), - /* K21 */ be_nested_str_weak(Occupancy), + /* K1 */ be_nested_str_weak(json), + /* K2 */ be_nested_str_weak(), + /* K3 */ be_nested_str_weak(get), + /* K4 */ be_nested_str_weak(JSON_NAME), + /* K5 */ be_nested_str_weak(contains), + /* K6 */ be_nested_str_weak(shadow_value), + /* K7 */ be_nested_str_weak(dump), + /* K8 */ be_nested_str_weak(null), + /* K9 */ be_nested_str_weak(_X2C_X22_X25s_X22_X3A_X25s), + /* K10 */ be_nested_str_weak(shadow_onoff), + /* K11 */ be_nested_str_weak(Power), + /* K12 */ be_nested_str_weak(shadow_bri), + /* K13 */ be_nested_str_weak(Bri), + /* K14 */ be_nested_str_weak(shadow_ct), + /* K15 */ be_nested_str_weak(CT), + /* K16 */ be_nested_str_weak(shadow_hue), + /* K17 */ be_nested_str_weak(Hue), + /* K18 */ be_nested_str_weak(shadow_sat), + /* K19 */ be_nested_str_weak(Sat), + /* K20 */ be_nested_str_weak(shadow_shutter_pos), + /* K21 */ be_nested_str_weak(ShutterPos), + /* K22 */ be_nested_str_weak(shadow_shutter_target), + /* K23 */ be_nested_str_weak(ShutterTarget), + /* K24 */ be_nested_str_weak(shadow_shutter_tilt), + /* K25 */ be_nested_str_weak(ShutterTilt), + /* K26 */ be_nested_str_weak(shadow_contact), + /* K27 */ be_nested_str_weak(Contact), + /* K28 */ be_nested_str_weak(shadow_occupancy), + /* K29 */ be_nested_str_weak(Occupancy), }), be_str_weak(append_state_json), &be_const_str_solidified, - ( &(const binstruction[45]) { /* code */ + ( &(const binstruction[71]) { /* code */ 0xA4060000, // 0000 IMPORT R1 K0 - 0x58080001, // 0001 LDCONST R2 K1 - 0x840C0000, // 0002 CLOSURE R3 P0 - 0x5C100600, // 0003 MOVE R4 R3 - 0x58140002, // 0004 LDCONST R5 K2 - 0x58180003, // 0005 LDCONST R6 K3 - 0x7C100400, // 0006 CALL R4 2 - 0x5C100600, // 0007 MOVE R4 R3 - 0x58140004, // 0008 LDCONST R5 K4 - 0x58180005, // 0009 LDCONST R6 K5 - 0x7C100400, // 000A CALL R4 2 - 0x5C100600, // 000B MOVE R4 R3 - 0x58140006, // 000C LDCONST R5 K6 - 0x58180007, // 000D LDCONST R6 K7 - 0x7C100400, // 000E CALL R4 2 - 0x5C100600, // 000F MOVE R4 R3 - 0x58140008, // 0010 LDCONST R5 K8 - 0x58180009, // 0011 LDCONST R6 K9 - 0x7C100400, // 0012 CALL R4 2 - 0x5C100600, // 0013 MOVE R4 R3 - 0x5814000A, // 0014 LDCONST R5 K10 - 0x5818000B, // 0015 LDCONST R6 K11 - 0x7C100400, // 0016 CALL R4 2 - 0x5C100600, // 0017 MOVE R4 R3 - 0x5814000C, // 0018 LDCONST R5 K12 - 0x5818000D, // 0019 LDCONST R6 K13 - 0x7C100400, // 001A CALL R4 2 - 0x5C100600, // 001B MOVE R4 R3 - 0x5814000E, // 001C LDCONST R5 K14 - 0x5818000F, // 001D LDCONST R6 K15 - 0x7C100400, // 001E CALL R4 2 - 0x5C100600, // 001F MOVE R4 R3 - 0x58140010, // 0020 LDCONST R5 K16 - 0x58180011, // 0021 LDCONST R6 K17 - 0x7C100400, // 0022 CALL R4 2 - 0x5C100600, // 0023 MOVE R4 R3 - 0x58140012, // 0024 LDCONST R5 K18 - 0x58180013, // 0025 LDCONST R6 K19 - 0x7C100400, // 0026 CALL R4 2 - 0x5C100600, // 0027 MOVE R4 R3 - 0x58140014, // 0028 LDCONST R5 K20 - 0x58180015, // 0029 LDCONST R6 K21 - 0x7C100400, // 002A CALL R4 2 - 0xA0000000, // 002B CLOSE R0 - 0x80040400, // 002C RET 1 R2 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x580C0002, // 0002 LDCONST R3 K2 + 0x84100000, // 0003 CLOSURE R4 P0 + 0x8C140303, // 0004 GETMET R5 R1 K3 + 0x5C1C0000, // 0005 MOVE R7 R0 + 0x58200004, // 0006 LDCONST R8 K4 + 0x7C140600, // 0007 CALL R5 3 + 0x78160013, // 0008 JMPF R5 #001D + 0x8C180305, // 0009 GETMET R6 R1 K5 + 0x5C200000, // 000A MOVE R8 R0 + 0x58240006, // 000B LDCONST R9 K6 + 0x7C180600, // 000C CALL R6 3 + 0x781A000E, // 000D JMPF R6 #001D + 0x88180106, // 000E GETMBR R6 R0 K6 + 0x4C1C0000, // 000F LDNIL R7 + 0x20180C07, // 0010 NE R6 R6 R7 + 0x781A0003, // 0011 JMPF R6 #0016 + 0x8C180507, // 0012 GETMET R6 R2 K7 + 0x88200106, // 0013 GETMBR R8 R0 K6 + 0x7C180400, // 0014 CALL R6 2 + 0x70020000, // 0015 JMP #0017 + 0x58180008, // 0016 LDCONST R6 K8 + 0x601C0018, // 0017 GETGBL R7 G24 + 0x58200009, // 0018 LDCONST R8 K9 + 0x5C240A00, // 0019 MOVE R9 R5 + 0x5C280C00, // 001A MOVE R10 R6 + 0x7C1C0600, // 001B CALL R7 3 + 0x000C0607, // 001C ADD R3 R3 R7 + 0x5C180800, // 001D MOVE R6 R4 + 0x581C000A, // 001E LDCONST R7 K10 + 0x5820000B, // 001F LDCONST R8 K11 + 0x7C180400, // 0020 CALL R6 2 + 0x5C180800, // 0021 MOVE R6 R4 + 0x581C000C, // 0022 LDCONST R7 K12 + 0x5820000D, // 0023 LDCONST R8 K13 + 0x7C180400, // 0024 CALL R6 2 + 0x5C180800, // 0025 MOVE R6 R4 + 0x581C000E, // 0026 LDCONST R7 K14 + 0x5820000F, // 0027 LDCONST R8 K15 + 0x7C180400, // 0028 CALL R6 2 + 0x5C180800, // 0029 MOVE R6 R4 + 0x581C0010, // 002A LDCONST R7 K16 + 0x58200011, // 002B LDCONST R8 K17 + 0x7C180400, // 002C CALL R6 2 + 0x5C180800, // 002D MOVE R6 R4 + 0x581C0012, // 002E LDCONST R7 K18 + 0x58200013, // 002F LDCONST R8 K19 + 0x7C180400, // 0030 CALL R6 2 + 0x5C180800, // 0031 MOVE R6 R4 + 0x581C0014, // 0032 LDCONST R7 K20 + 0x58200015, // 0033 LDCONST R8 K21 + 0x7C180400, // 0034 CALL R6 2 + 0x5C180800, // 0035 MOVE R6 R4 + 0x581C0016, // 0036 LDCONST R7 K22 + 0x58200017, // 0037 LDCONST R8 K23 + 0x7C180400, // 0038 CALL R6 2 + 0x5C180800, // 0039 MOVE R6 R4 + 0x581C0018, // 003A LDCONST R7 K24 + 0x58200019, // 003B LDCONST R8 K25 + 0x7C180400, // 003C CALL R6 2 + 0x5C180800, // 003D MOVE R6 R4 + 0x581C001A, // 003E LDCONST R7 K26 + 0x5820001B, // 003F LDCONST R8 K27 + 0x7C180400, // 0040 CALL R6 2 + 0x5C180800, // 0041 MOVE R6 R4 + 0x581C001C, // 0042 LDCONST R7 K28 + 0x5820001D, // 0043 LDCONST R8 K29 + 0x7C180400, // 0044 CALL R6 2 + 0xA0000000, // 0045 CLOSE R0 + 0x80040600, // 0046 RET 1 R3 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h index e2d100e7b..ee3304726 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h @@ -6,230 +6,6 @@ extern const bclass be_class_Matter_Plugin_Sensor; -/******************************************************************** -** Solidified function: append_state_json -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_append_state_json, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(shadow_value), - /* K1 */ be_nested_str_weak(null), - /* K2 */ be_nested_str_weak(_X2C_X22_X25s_X22_X3A_X25s), - /* K3 */ be_nested_str_weak(JSON_NAME), - }), - be_str_weak(append_state_json), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x20040202, // 0002 NE R1 R1 R2 - 0x78060001, // 0003 JMPF R1 #0006 - 0x88040100, // 0004 GETMBR R1 R0 K0 - 0x70020000, // 0005 JMP #0007 - 0x58040001, // 0006 LDCONST R1 K1 - 0x60080018, // 0007 GETGBL R2 G24 - 0x580C0002, // 0008 LDCONST R3 K2 - 0x88100103, // 0009 GETMBR R4 R0 K3 - 0x5C140200, // 000A MOVE R5 R1 - 0x7C080600, // 000B CALL R2 3 - 0x80040400, // 000C RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_init, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(init), - /* K1 */ be_nested_str_weak(add_read_sensors_schedule), - /* K2 */ be_nested_str_weak(UPDATE_TIME), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x60100003, // 0000 GETGBL R4 G3 - 0x5C140000, // 0001 MOVE R5 R0 - 0x7C100200, // 0002 CALL R4 1 - 0x8C100900, // 0003 GETMET R4 R4 K0 - 0x5C180200, // 0004 MOVE R6 R1 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x5C200600, // 0006 MOVE R8 R3 - 0x7C100800, // 0007 CALL R4 4 - 0x8C100301, // 0008 GETMET R4 R1 K1 - 0x88180102, // 0009 GETMBR R6 R0 K2 - 0x7C100400, // 000A CALL R4 2 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: value_changed -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_value_changed, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(value_changed), - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: parse_configuration -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_parse_configuration, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota_sensor_filter), - /* K1 */ be_nested_str_weak(find), - /* K2 */ be_nested_str_weak(ARG), - /* K3 */ be_nested_str_weak(tasmota_sensor_matcher), - /* K4 */ be_nested_str_weak(tasmota), - /* K5 */ be_nested_str_weak(Rule_Matcher), - /* K6 */ be_nested_str_weak(parse), - }), - be_str_weak(parse_configuration), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x8C080301, // 0000 GETMET R2 R1 K1 - 0x88100102, // 0001 GETMBR R4 R0 K2 - 0x7C080400, // 0002 CALL R2 2 - 0x90020002, // 0003 SETMBR R0 K0 R2 - 0x88080100, // 0004 GETMBR R2 R0 K0 - 0x780A0005, // 0005 JMPF R2 #000C - 0xB80A0800, // 0006 GETNGBL R2 K4 - 0x88080505, // 0007 GETMBR R2 R2 K5 - 0x8C080506, // 0008 GETMET R2 R2 K6 - 0x88100100, // 0009 GETMBR R4 R0 K0 - 0x7C080400, // 000A CALL R2 2 - 0x90020602, // 000B SETMBR R0 K3 R2 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: parse_sensors -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_parse_sensors, /* name */ - be_nested_proto( - 8, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(VIRTUAL), - /* K1 */ be_nested_str_weak(tasmota_sensor_matcher), - /* K2 */ be_nested_str_weak(pre_value), - /* K3 */ be_nested_str_weak(match), - /* K4 */ be_nested_str_weak(shadow_value), - /* K5 */ be_nested_str_weak(value_changed), - }), - be_str_weak(parse_sensors), - &be_const_str_solidified, - ( &(const binstruction[22]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x740A0012, // 0001 JMPT R2 #0015 - 0x88080101, // 0002 GETMBR R2 R0 K1 - 0x780A0010, // 0003 JMPF R2 #0015 - 0x8C080102, // 0004 GETMET R2 R0 K2 - 0x6010000A, // 0005 GETGBL R4 G10 - 0x88140101, // 0006 GETMBR R5 R0 K1 - 0x8C140B03, // 0007 GETMET R5 R5 K3 - 0x5C1C0200, // 0008 MOVE R7 R1 - 0x7C140400, // 0009 CALL R5 2 - 0x7C100200, // 000A CALL R4 1 - 0x7C080400, // 000B CALL R2 2 - 0x4C0C0000, // 000C LDNIL R3 - 0x200C0403, // 000D NE R3 R2 R3 - 0x780E0005, // 000E JMPF R3 #0015 - 0x880C0104, // 000F GETMBR R3 R0 K4 - 0x200C0403, // 0010 NE R3 R2 R3 - 0x780E0002, // 0011 JMPF R3 #0015 - 0x8C0C0105, // 0012 GETMET R3 R0 K5 - 0x7C0C0200, // 0013 CALL R3 1 - 0x90020802, // 0014 SETMBR R0 K4 R2 - 0x80000000, // 0015 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pre_value -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_pre_value, /* name */ - be_nested_proto( - 2, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(pre_value), - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80040200, // 0000 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: update_virtual ********************************************************************/ @@ -288,6 +64,189 @@ be_local_closure(Matter_Plugin_Sensor_update_virtual, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: parse_sensors +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_parse_sensors, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(tasmota_sensor_matcher), + /* K2 */ be_nested_str_weak(pre_value), + /* K3 */ be_nested_str_weak(match), + /* K4 */ be_nested_str_weak(shadow_value), + /* K5 */ be_nested_str_weak(value_changed), + }), + be_str_weak(parse_sensors), + &be_const_str_solidified, + ( &(const binstruction[22]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x740A0012, // 0001 JMPT R2 #0015 + 0x88080101, // 0002 GETMBR R2 R0 K1 + 0x780A0010, // 0003 JMPF R2 #0015 + 0x8C080102, // 0004 GETMET R2 R0 K2 + 0x6010000A, // 0005 GETGBL R4 G10 + 0x88140101, // 0006 GETMBR R5 R0 K1 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0x5C1C0200, // 0008 MOVE R7 R1 + 0x7C140400, // 0009 CALL R5 2 + 0x7C100200, // 000A CALL R4 1 + 0x7C080400, // 000B CALL R2 2 + 0x4C0C0000, // 000C LDNIL R3 + 0x200C0403, // 000D NE R3 R2 R3 + 0x780E0005, // 000E JMPF R3 #0015 + 0x880C0104, // 000F GETMBR R3 R0 K4 + 0x200C0403, // 0010 NE R3 R2 R3 + 0x780E0002, // 0011 JMPF R3 #0015 + 0x8C0C0105, // 0012 GETMET R3 R0 K5 + 0x7C0C0200, // 0013 CALL R3 1 + 0x90020802, // 0014 SETMBR R0 K4 R2 + 0x80000000, // 0015 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: parse_configuration +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_parse_configuration, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota_sensor_filter), + /* K1 */ be_nested_str_weak(find), + /* K2 */ be_nested_str_weak(ARG), + /* K3 */ be_nested_str_weak(tasmota_sensor_matcher), + /* K4 */ be_nested_str_weak(tasmota), + /* K5 */ be_nested_str_weak(Rule_Matcher), + /* K6 */ be_nested_str_weak(parse), + }), + be_str_weak(parse_configuration), + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0x8C080301, // 0000 GETMET R2 R1 K1 + 0x88100102, // 0001 GETMBR R4 R0 K2 + 0x7C080400, // 0002 CALL R2 2 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x780A0005, // 0005 JMPF R2 #000C + 0xB80A0800, // 0006 GETNGBL R2 K4 + 0x88080505, // 0007 GETMBR R2 R2 K5 + 0x8C080506, // 0008 GETMET R2 R2 K6 + 0x88100100, // 0009 GETMBR R4 R0 K0 + 0x7C080400, // 000A CALL R2 2 + 0x90020602, // 000B SETMBR R0 K3 R2 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_init, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(add_read_sensors_schedule), + /* K2 */ be_nested_str_weak(UPDATE_TIME), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x60100003, // 0000 GETGBL R4 G3 + 0x5C140000, // 0001 MOVE R5 R0 + 0x7C100200, // 0002 CALL R4 1 + 0x8C100900, // 0003 GETMET R4 R4 K0 + 0x5C180200, // 0004 MOVE R6 R1 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x5C200600, // 0006 MOVE R8 R3 + 0x7C100800, // 0007 CALL R4 4 + 0x8C100301, // 0008 GETMET R4 R1 K1 + 0x88180102, // 0009 GETMBR R6 R0 K2 + 0x7C100400, // 000A CALL R4 2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pre_value +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_pre_value, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(pre_value), + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80040200, // 0000 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: value_changed +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_value_changed, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(value_changed), + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified class: Matter_Plugin_Sensor ********************************************************************/ @@ -295,22 +254,21 @@ extern const bclass be_class_Matter_Plugin_Device; be_local_class(Matter_Plugin_Sensor, 3, &be_class_Matter_Plugin_Device, - be_nested_map(14, + be_nested_map(13, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(UPDATE_TIME, 3), be_const_int(5000) }, - { be_const_key_weak(ARG, -1), be_nested_str_weak(filter) }, - { be_const_key_weak(append_state_json, 0), be_const_closure(Matter_Plugin_Sensor_append_state_json_closure) }, - { be_const_key_weak(update_virtual, -1), be_const_closure(Matter_Plugin_Sensor_update_virtual_closure) }, - { be_const_key_weak(tasmota_sensor_filter, -1), be_const_var(0) }, - { be_const_key_weak(init, 13), be_const_closure(Matter_Plugin_Sensor_init_closure) }, - { be_const_key_weak(tasmota_sensor_matcher, -1), be_const_var(1) }, - { be_const_key_weak(ARG_HINT, 12), be_nested_str_weak(Filter_X20pattern) }, - { be_const_key_weak(parse_sensors, 10), be_const_closure(Matter_Plugin_Sensor_parse_sensors_closure) }, - { be_const_key_weak(JSON_NAME, -1), be_nested_str_weak() }, - { be_const_key_weak(pre_value, -1), be_const_closure(Matter_Plugin_Sensor_pre_value_closure) }, - { be_const_key_weak(shadow_value, 7), be_const_var(2) }, - { be_const_key_weak(parse_configuration, -1), be_const_closure(Matter_Plugin_Sensor_parse_configuration_closure) }, + { be_const_key_weak(ARG, 1), be_nested_str_weak(filter) }, { be_const_key_weak(value_changed, -1), be_const_closure(Matter_Plugin_Sensor_value_changed_closure) }, + { be_const_key_weak(update_virtual, -1), be_const_closure(Matter_Plugin_Sensor_update_virtual_closure) }, + { be_const_key_weak(ARG_HINT, 9), be_nested_str_weak(Filter_X20pattern) }, + { be_const_key_weak(tasmota_sensor_matcher, -1), be_const_var(1) }, + { be_const_key_weak(parse_sensors, -1), be_const_closure(Matter_Plugin_Sensor_parse_sensors_closure) }, + { be_const_key_weak(JSON_NAME, 8), be_nested_str_weak() }, + { be_const_key_weak(parse_configuration, -1), be_const_closure(Matter_Plugin_Sensor_parse_configuration_closure) }, + { be_const_key_weak(init, -1), be_const_closure(Matter_Plugin_Sensor_init_closure) }, + { be_const_key_weak(pre_value, 12), be_const_closure(Matter_Plugin_Sensor_pre_value_closure) }, + { be_const_key_weak(shadow_value, -1), be_const_var(2) }, + { be_const_key_weak(UPDATE_TIME, -1), be_const_int(5000) }, + { be_const_key_weak(tasmota_sensor_filter, -1), be_const_var(0) }, })), be_str_weak(Matter_Plugin_Sensor) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Contact.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Contact.h index 1017a0d2d..dc4bd4205 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Contact.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Contact.h @@ -7,32 +7,26 @@ extern const bclass be_class_Matter_Plugin_Sensor_Contact; /******************************************************************** -** Solidified function: append_state_json +** Solidified function: ********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Contact_append_state_json, /* name */ +be_local_closure(Matter_Plugin_Sensor_Contact__X3Clambda_X3E, /* name */ be_nested_proto( - 5, /* nstack */ + 3, /* nstack */ 1, /* argc */ - 2, /* varg */ + 0, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(_X2C_X22Contact_X22_X3A_X25s), - /* K1 */ be_nested_str_weak(shadow_contact), - }), - be_str_weak(append_state_json), + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(_X3Clambda_X3E), &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x60040018, // 0000 GETGBL R1 G24 - 0x58080000, // 0001 LDCONST R2 K0 - 0x600C0009, // 0002 GETGBL R3 G9 - 0x88100101, // 0003 GETMBR R4 R0 K1 - 0x7C0C0200, // 0004 CALL R3 1 - 0x7C040400, // 0005 CALL R1 2 - 0x80040200, // 0006 RET 1 R1 + ( &(const binstruction[ 4]) { /* code */ + 0x60040009, // 0000 GETGBL R1 G9 + 0x5C080000, // 0001 MOVE R2 R0 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 }) ) ); @@ -40,40 +34,36 @@ be_local_closure(Matter_Plugin_Sensor_Contact_append_state_json, /* name */ /******************************************************************** -** Solidified function: parse_configuration +** Solidified function: init ********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Contact_parse_configuration, /* name */ +be_local_closure(Matter_Plugin_Sensor_Contact_init, /* name */ be_nested_proto( - 7, /* nstack */ - 2, /* argc */ + 9, /* nstack */ + 4, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota_switch_index), - /* K1 */ be_nested_str_weak(find), - /* K2 */ be_nested_str_weak(ARG), - /* K3 */ be_const_int(1), - /* K4 */ be_const_int(0), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(shadow_contact), }), - be_str_weak(parse_configuration), + be_str_weak(init), &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x60080009, // 0000 GETGBL R2 G9 - 0x8C0C0301, // 0001 GETMET R3 R1 K1 - 0x88140102, // 0002 GETMBR R5 R0 K2 - 0x58180003, // 0003 LDCONST R6 K3 - 0x7C0C0600, // 0004 CALL R3 3 - 0x7C080200, // 0005 CALL R2 1 - 0x90020002, // 0006 SETMBR R0 K0 R2 - 0x88080100, // 0007 GETMBR R2 R0 K0 - 0x18080504, // 0008 LE R2 R2 K4 - 0x780A0000, // 0009 JMPF R2 #000B - 0x90020103, // 000A SETMBR R0 K0 K3 - 0x80000000, // 000B RET 0 + ( &(const binstruction[11]) { /* code */ + 0x60100003, // 0000 GETGBL R4 G3 + 0x5C140000, // 0001 MOVE R5 R0 + 0x7C100200, // 0002 CALL R4 1 + 0x8C100900, // 0003 GETMET R4 R4 K0 + 0x5C180200, // 0004 MOVE R6 R1 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x5C200600, // 0006 MOVE R8 R3 + 0x7C100800, // 0007 CALL R4 4 + 0x50100000, // 0008 LDBOOL R4 0 0 + 0x90020204, // 0009 SETMBR R0 K1 R4 + 0x80000000, // 000A RET 0 }) ) ); @@ -162,9 +152,9 @@ be_local_closure(Matter_Plugin_Sensor_Contact_update_shadow, /* name */ /******************************************************************** -** Solidified function: update_virtual +** Solidified function: parse_configuration ********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Contact_update_virtual, /* name */ +be_local_closure(Matter_Plugin_Sensor_Contact_parse_configuration, /* name */ be_nested_proto( 7, /* nstack */ 2, /* argc */ @@ -174,106 +164,28 @@ be_local_closure(Matter_Plugin_Sensor_Contact_update_virtual, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(find), - /* K1 */ be_nested_str_weak(Contact), - /* K2 */ be_nested_str_weak(shadow_contact), - /* K3 */ be_nested_str_weak(attribute_updated), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota_switch_index), + /* K1 */ be_nested_str_weak(find), + /* K2 */ be_nested_str_weak(ARG), + /* K3 */ be_const_int(1), /* K4 */ be_const_int(0), - /* K5 */ be_nested_str_weak(update_virtual), }), - be_str_weak(update_virtual), + be_str_weak(parse_configuration), &be_const_str_solidified, - ( &(const binstruction[25]) { /* code */ - 0x8C080300, // 0000 GETMET R2 R1 K0 - 0x58100001, // 0001 LDCONST R4 K1 - 0x7C080400, // 0002 CALL R2 2 - 0x4C0C0000, // 0003 LDNIL R3 - 0x200C0403, // 0004 NE R3 R2 R3 - 0x780E000B, // 0005 JMPF R3 #0012 - 0x600C0017, // 0006 GETGBL R3 G23 - 0x5C100400, // 0007 MOVE R4 R2 - 0x7C0C0200, // 0008 CALL R3 1 - 0x5C080600, // 0009 MOVE R2 R3 - 0x880C0102, // 000A GETMBR R3 R0 K2 - 0x200C0602, // 000B NE R3 R3 R2 - 0x780E0004, // 000C JMPF R3 #0012 - 0x8C0C0103, // 000D GETMET R3 R0 K3 - 0x54160044, // 000E LDINT R5 69 - 0x58180004, // 000F LDCONST R6 K4 - 0x7C0C0600, // 0010 CALL R3 3 - 0x90020402, // 0011 SETMBR R0 K2 R2 - 0x600C0003, // 0012 GETGBL R3 G3 - 0x5C100000, // 0013 MOVE R4 R0 - 0x7C0C0200, // 0014 CALL R3 1 - 0x8C0C0705, // 0015 GETMET R3 R3 K5 - 0x5C140200, // 0016 MOVE R5 R1 - 0x7C0C0400, // 0017 CALL R3 2 - 0x80000000, // 0018 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Contact__X3Clambda_X3E, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x60040009, // 0000 GETGBL R1 G9 - 0x5C080000, // 0001 MOVE R2 R0 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Contact_init, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(init), - /* K1 */ be_nested_str_weak(shadow_contact), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[11]) { /* code */ - 0x60100003, // 0000 GETGBL R4 G3 - 0x5C140000, // 0001 MOVE R5 R0 - 0x7C100200, // 0002 CALL R4 1 - 0x8C100900, // 0003 GETMET R4 R4 K0 - 0x5C180200, // 0004 MOVE R6 R1 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x5C200600, // 0006 MOVE R8 R3 - 0x7C100800, // 0007 CALL R4 4 - 0x50100000, // 0008 LDBOOL R4 0 0 - 0x90020204, // 0009 SETMBR R0 K1 R4 - 0x80000000, // 000A RET 0 + ( &(const binstruction[12]) { /* code */ + 0x60080009, // 0000 GETGBL R2 G9 + 0x8C0C0301, // 0001 GETMET R3 R1 K1 + 0x88140102, // 0002 GETMBR R5 R0 K2 + 0x58180003, // 0003 LDCONST R6 K3 + 0x7C0C0600, // 0004 CALL R3 3 + 0x7C080200, // 0005 CALL R2 1 + 0x90020002, // 0006 SETMBR R0 K0 R2 + 0x88080100, // 0007 GETMBR R2 R0 K0 + 0x18080504, // 0008 LE R2 R2 K4 + 0x780A0000, // 0009 JMPF R2 #000B + 0x90020103, // 000A SETMBR R0 K0 K3 + 0x80000000, // 000B RET 0 }) ) ); @@ -369,6 +281,61 @@ be_local_closure(Matter_Plugin_Sensor_Contact_read_attribute, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: update_virtual +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Contact_update_virtual, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(find), + /* K1 */ be_nested_str_weak(Contact), + /* K2 */ be_nested_str_weak(shadow_contact), + /* K3 */ be_nested_str_weak(attribute_updated), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(update_virtual), + }), + be_str_weak(update_virtual), + &be_const_str_solidified, + ( &(const binstruction[25]) { /* code */ + 0x8C080300, // 0000 GETMET R2 R1 K0 + 0x58100001, // 0001 LDCONST R4 K1 + 0x7C080400, // 0002 CALL R2 2 + 0x4C0C0000, // 0003 LDNIL R3 + 0x200C0403, // 0004 NE R3 R2 R3 + 0x780E000B, // 0005 JMPF R3 #0012 + 0x600C0017, // 0006 GETGBL R3 G23 + 0x5C100400, // 0007 MOVE R4 R2 + 0x7C0C0200, // 0008 CALL R3 1 + 0x5C080600, // 0009 MOVE R2 R3 + 0x880C0102, // 000A GETMBR R3 R0 K2 + 0x200C0602, // 000B NE R3 R3 R2 + 0x780E0004, // 000C JMPF R3 #0012 + 0x8C0C0103, // 000D GETMET R3 R0 K3 + 0x54160044, // 000E LDINT R5 69 + 0x58180004, // 000F LDCONST R6 K4 + 0x7C0C0600, // 0010 CALL R3 3 + 0x90020402, // 0011 SETMBR R0 K2 R2 + 0x600C0003, // 0012 GETGBL R3 G3 + 0x5C100000, // 0013 MOVE R4 R0 + 0x7C0C0200, // 0014 CALL R3 1 + 0x8C0C0705, // 0015 GETMET R3 R3 K5 + 0x5C140200, // 0016 MOVE R5 R1 + 0x7C0C0400, // 0017 CALL R3 2 + 0x80000000, // 0018 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified class: Matter_Plugin_Sensor_Contact ********************************************************************/ @@ -376,22 +343,29 @@ extern const bclass be_class_Matter_Plugin_Device; be_local_class(Matter_Plugin_Sensor_Contact, 2, &be_class_Matter_Plugin_Device, - be_nested_map(17, + be_nested_map(16, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(read_attribute, 12), be_const_closure(Matter_Plugin_Sensor_Contact_read_attribute_closure) }, - { be_const_key_weak(append_state_json, -1), be_const_closure(Matter_Plugin_Sensor_Contact_append_state_json_closure) }, + { be_const_key_weak(ARG_TYPE, 4), be_const_static_closure(Matter_Plugin_Sensor_Contact__X3Clambda_X3E_closure) }, { be_const_key_weak(ARG_HINT, -1), be_nested_str_weak(Switch_X3Cx_X3E_X20number) }, + { be_const_key_weak(shadow_contact, -1), be_const_var(1) }, { be_const_key_weak(init, -1), be_const_closure(Matter_Plugin_Sensor_Contact_init_closure) }, - { be_const_key_weak(TYPES, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + { be_const_key_weak(update_virtual, -1), be_const_closure(Matter_Plugin_Sensor_Contact_update_virtual_closure) }, + { be_const_key_weak(update_shadow, 15), be_const_closure(Matter_Plugin_Sensor_Contact_update_shadow_closure) }, + { be_const_key_weak(UPDATE_COMMANDS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(1, + ( (struct bvalue*) &(const bvalue[]) { + be_nested_str_weak(Contact), + })) ) } )) }, + { be_const_key_weak(ARG, 6), be_nested_str_weak(switch) }, + { be_const_key_weak(UPDATE_TIME, -1), be_const_int(750) }, + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Contact) }, + { be_const_key_weak(tasmota_switch_index, 11), be_const_var(0) }, + { be_const_key_weak(TYPES, 12), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { be_const_map( * be_nested_map(1, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key_int(21, -1), be_const_int(1) }, })) ) } )) }, - { be_const_key_weak(parse_configuration, -1), be_const_closure(Matter_Plugin_Sensor_Contact_parse_configuration_closure) }, - { be_const_key_weak(shadow_contact, 16), be_const_var(1) }, - { be_const_key_weak(update_virtual, -1), be_const_closure(Matter_Plugin_Sensor_Contact_update_virtual_closure) }, - { be_const_key_weak(ARG, 7), be_nested_str_weak(switch) }, - { be_const_key_weak(CLUSTERS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + { be_const_key_weak(CLUSTERS, 14), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { be_const_map( * be_nested_map(6, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key_int(5, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { @@ -449,17 +423,9 @@ be_local_class(Matter_Plugin_Sensor_Contact, be_const_int(65533), })) ) } )) }, })) ) } )) }, - { be_const_key_weak(tasmota_switch_index, -1), be_const_var(0) }, - { be_const_key_weak(DISPLAY_NAME, 0), be_nested_str_weak(Contact) }, - { be_const_key_weak(ARG_TYPE, 13), be_const_static_closure(Matter_Plugin_Sensor_Contact__X3Clambda_X3E_closure) }, - { be_const_key_weak(UPDATE_TIME, -1), be_const_int(750) }, - { be_const_key_weak(TYPE, -1), be_nested_str_weak(contact) }, - { be_const_key_weak(UPDATE_COMMANDS, 3), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(1, - ( (struct bvalue*) &(const bvalue[]) { - be_nested_str_weak(Contact), - })) ) } )) }, - { be_const_key_weak(update_shadow, -1), be_const_closure(Matter_Plugin_Sensor_Contact_update_shadow_closure) }, + { be_const_key_weak(TYPE, 9), be_nested_str_weak(contact) }, + { be_const_key_weak(read_attribute, -1), be_const_closure(Matter_Plugin_Sensor_Contact_read_attribute_closure) }, + { be_const_key_weak(parse_configuration, -1), be_const_closure(Matter_Plugin_Sensor_Contact_parse_configuration_closure) }, })), be_str_weak(Matter_Plugin_Sensor_Contact) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h index b88b02bd3..a26bb32ad 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h @@ -7,32 +7,26 @@ extern const bclass be_class_Matter_Plugin_Sensor_Occupancy; /******************************************************************** -** Solidified function: append_state_json +** Solidified function: ********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Occupancy_append_state_json, /* name */ +be_local_closure(Matter_Plugin_Sensor_Occupancy__X3Clambda_X3E, /* name */ be_nested_proto( - 5, /* nstack */ + 3, /* nstack */ 1, /* argc */ - 2, /* varg */ + 0, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(_X2C_X22Occupancy_X22_X3A_X25s), - /* K1 */ be_nested_str_weak(shadow_occupancy), - }), - be_str_weak(append_state_json), + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(_X3Clambda_X3E), &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x60040018, // 0000 GETGBL R1 G24 - 0x58080000, // 0001 LDCONST R2 K0 - 0x600C0009, // 0002 GETGBL R3 G9 - 0x88100101, // 0003 GETMBR R4 R0 K1 - 0x7C0C0200, // 0004 CALL R3 1 - 0x7C040400, // 0005 CALL R1 2 - 0x80040200, // 0006 RET 1 R1 + ( &(const binstruction[ 4]) { /* code */ + 0x60040009, // 0000 GETGBL R1 G9 + 0x5C080000, // 0001 MOVE R2 R0 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 }) ) ); @@ -40,9 +34,9 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_append_state_json, /* name */ /******************************************************************** -** Solidified function: parse_configuration +** Solidified function: update_virtual ********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Occupancy_parse_configuration, /* name */ +be_local_closure(Matter_Plugin_Sensor_Occupancy_update_virtual, /* name */ be_nested_proto( 7, /* nstack */ 2, /* argc */ @@ -52,28 +46,79 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_parse_configuration, /* name * 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota_switch_index), - /* K1 */ be_nested_str_weak(find), - /* K2 */ be_nested_str_weak(ARG), - /* K3 */ be_const_int(1), + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(find), + /* K1 */ be_nested_str_weak(Occupancy), + /* K2 */ be_nested_str_weak(shadow_occupancy), + /* K3 */ be_nested_str_weak(attribute_updated), /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(update_virtual), }), - be_str_weak(parse_configuration), + be_str_weak(update_virtual), &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x60080009, // 0000 GETGBL R2 G9 - 0x8C0C0301, // 0001 GETMET R3 R1 K1 - 0x88140102, // 0002 GETMBR R5 R0 K2 - 0x58180003, // 0003 LDCONST R6 K3 - 0x7C0C0600, // 0004 CALL R3 3 - 0x7C080200, // 0005 CALL R2 1 - 0x90020002, // 0006 SETMBR R0 K0 R2 - 0x88080100, // 0007 GETMBR R2 R0 K0 - 0x18080504, // 0008 LE R2 R2 K4 - 0x780A0000, // 0009 JMPF R2 #000B - 0x90020103, // 000A SETMBR R0 K0 K3 - 0x80000000, // 000B RET 0 + ( &(const binstruction[25]) { /* code */ + 0x8C080300, // 0000 GETMET R2 R1 K0 + 0x58100001, // 0001 LDCONST R4 K1 + 0x7C080400, // 0002 CALL R2 2 + 0x4C0C0000, // 0003 LDNIL R3 + 0x200C0403, // 0004 NE R3 R2 R3 + 0x780E000B, // 0005 JMPF R3 #0012 + 0x600C0017, // 0006 GETGBL R3 G23 + 0x5C100400, // 0007 MOVE R4 R2 + 0x7C0C0200, // 0008 CALL R3 1 + 0x5C080600, // 0009 MOVE R2 R3 + 0x880C0102, // 000A GETMBR R3 R0 K2 + 0x200C0602, // 000B NE R3 R3 R2 + 0x780E0004, // 000C JMPF R3 #0012 + 0x8C0C0103, // 000D GETMET R3 R0 K3 + 0x54160405, // 000E LDINT R5 1030 + 0x58180004, // 000F LDCONST R6 K4 + 0x7C0C0600, // 0010 CALL R3 3 + 0x90020402, // 0011 SETMBR R0 K2 R2 + 0x600C0003, // 0012 GETGBL R3 G3 + 0x5C100000, // 0013 MOVE R4 R0 + 0x7C0C0200, // 0014 CALL R3 1 + 0x8C0C0705, // 0015 GETMET R3 R3 K5 + 0x5C140200, // 0016 MOVE R5 R1 + 0x7C0C0400, // 0017 CALL R3 2 + 0x80000000, // 0018 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Occupancy_init, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(shadow_occupancy), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[11]) { /* code */ + 0x60100003, // 0000 GETGBL R4 G3 + 0x5C140000, // 0001 MOVE R5 R0 + 0x7C100200, // 0002 CALL R4 1 + 0x8C100900, // 0003 GETMET R4 R4 K0 + 0x5C180200, // 0004 MOVE R6 R1 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x5C200600, // 0006 MOVE R8 R3 + 0x7C100800, // 0007 CALL R4 4 + 0x50100000, // 0008 LDBOOL R4 0 0 + 0x90020204, // 0009 SETMBR R0 K1 R4 + 0x80000000, // 000A RET 0 }) ) ); @@ -162,9 +207,9 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_update_shadow, /* name */ /******************************************************************** -** Solidified function: update_virtual +** Solidified function: parse_configuration ********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Occupancy_update_virtual, /* name */ +be_local_closure(Matter_Plugin_Sensor_Occupancy_parse_configuration, /* name */ be_nested_proto( 7, /* nstack */ 2, /* argc */ @@ -174,106 +219,28 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_update_virtual, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(find), - /* K1 */ be_nested_str_weak(Occupancy), - /* K2 */ be_nested_str_weak(shadow_occupancy), - /* K3 */ be_nested_str_weak(attribute_updated), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota_switch_index), + /* K1 */ be_nested_str_weak(find), + /* K2 */ be_nested_str_weak(ARG), + /* K3 */ be_const_int(1), /* K4 */ be_const_int(0), - /* K5 */ be_nested_str_weak(update_virtual), }), - be_str_weak(update_virtual), + be_str_weak(parse_configuration), &be_const_str_solidified, - ( &(const binstruction[25]) { /* code */ - 0x8C080300, // 0000 GETMET R2 R1 K0 - 0x58100001, // 0001 LDCONST R4 K1 - 0x7C080400, // 0002 CALL R2 2 - 0x4C0C0000, // 0003 LDNIL R3 - 0x200C0403, // 0004 NE R3 R2 R3 - 0x780E000B, // 0005 JMPF R3 #0012 - 0x600C0017, // 0006 GETGBL R3 G23 - 0x5C100400, // 0007 MOVE R4 R2 - 0x7C0C0200, // 0008 CALL R3 1 - 0x5C080600, // 0009 MOVE R2 R3 - 0x880C0102, // 000A GETMBR R3 R0 K2 - 0x200C0602, // 000B NE R3 R3 R2 - 0x780E0004, // 000C JMPF R3 #0012 - 0x8C0C0103, // 000D GETMET R3 R0 K3 - 0x54160405, // 000E LDINT R5 1030 - 0x58180004, // 000F LDCONST R6 K4 - 0x7C0C0600, // 0010 CALL R3 3 - 0x90020402, // 0011 SETMBR R0 K2 R2 - 0x600C0003, // 0012 GETGBL R3 G3 - 0x5C100000, // 0013 MOVE R4 R0 - 0x7C0C0200, // 0014 CALL R3 1 - 0x8C0C0705, // 0015 GETMET R3 R3 K5 - 0x5C140200, // 0016 MOVE R5 R1 - 0x7C0C0400, // 0017 CALL R3 2 - 0x80000000, // 0018 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Occupancy__X3Clambda_X3E, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x60040009, // 0000 GETGBL R1 G9 - 0x5C080000, // 0001 MOVE R2 R0 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Matter_Plugin_Sensor_Occupancy_init, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(init), - /* K1 */ be_nested_str_weak(shadow_occupancy), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[11]) { /* code */ - 0x60100003, // 0000 GETGBL R4 G3 - 0x5C140000, // 0001 MOVE R5 R0 - 0x7C100200, // 0002 CALL R4 1 - 0x8C100900, // 0003 GETMET R4 R4 K0 - 0x5C180200, // 0004 MOVE R6 R1 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x5C200600, // 0006 MOVE R8 R3 - 0x7C100800, // 0007 CALL R4 4 - 0x50100000, // 0008 LDBOOL R4 0 0 - 0x90020204, // 0009 SETMBR R0 K1 R4 - 0x80000000, // 000A RET 0 + ( &(const binstruction[12]) { /* code */ + 0x60080009, // 0000 GETGBL R2 G9 + 0x8C0C0301, // 0001 GETMET R3 R1 K1 + 0x88140102, // 0002 GETMBR R5 R0 K2 + 0x58180003, // 0003 LDCONST R6 K3 + 0x7C0C0600, // 0004 CALL R3 3 + 0x7C080200, // 0005 CALL R2 1 + 0x90020002, // 0006 SETMBR R0 K0 R2 + 0x88080100, // 0007 GETMBR R2 R0 K0 + 0x18080504, // 0008 LE R2 R2 K4 + 0x780A0000, // 0009 JMPF R2 #000B + 0x90020103, // 000A SETMBR R0 K0 K3 + 0x80000000, // 000B RET 0 }) ) ); @@ -394,22 +361,18 @@ extern const bclass be_class_Matter_Plugin_Device; be_local_class(Matter_Plugin_Sensor_Occupancy, 2, &be_class_Matter_Plugin_Device, - be_nested_map(17, + be_nested_map(16, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(read_attribute, 12), be_const_closure(Matter_Plugin_Sensor_Occupancy_read_attribute_closure) }, - { be_const_key_weak(append_state_json, -1), be_const_closure(Matter_Plugin_Sensor_Occupancy_append_state_json_closure) }, + { be_const_key_weak(ARG_TYPE, 2), be_const_static_closure(Matter_Plugin_Sensor_Occupancy__X3Clambda_X3E_closure) }, { be_const_key_weak(ARG_HINT, -1), be_nested_str_weak(Switch_X3Cx_X3E_X20number) }, + { be_const_key_weak(update_virtual, -1), be_const_closure(Matter_Plugin_Sensor_Occupancy_update_virtual_closure) }, { be_const_key_weak(init, -1), be_const_closure(Matter_Plugin_Sensor_Occupancy_init_closure) }, - { be_const_key_weak(TYPES, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { - be_const_map( * be_nested_map(1, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_int(263, -1), be_const_int(2) }, - })) ) } )) }, - { be_const_key_weak(parse_configuration, -1), be_const_closure(Matter_Plugin_Sensor_Occupancy_parse_configuration_closure) }, - { be_const_key_weak(update_shadow, -1), be_const_closure(Matter_Plugin_Sensor_Occupancy_update_shadow_closure) }, + { be_const_key_weak(tasmota_switch_index, 9), be_const_var(0) }, + { be_const_key_weak(update_shadow, 14), be_const_closure(Matter_Plugin_Sensor_Occupancy_update_shadow_closure) }, { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Occupancy) }, - { be_const_key_weak(ARG, 16), be_nested_str_weak(switch) }, - { be_const_key_weak(CLUSTERS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + { be_const_key_weak(ARG, 12), be_nested_str_weak(switch) }, + { be_const_key_weak(UPDATE_TIME, -1), be_const_int(750) }, + { be_const_key_weak(CLUSTERS, 11), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { be_const_map( * be_nested_map(6, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key_int(5, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { @@ -469,17 +432,20 @@ be_local_class(Matter_Plugin_Sensor_Occupancy, be_const_int(65533), })) ) } )) }, })) ) } )) }, - { be_const_key_weak(tasmota_switch_index, -1), be_const_var(0) }, - { be_const_key_weak(UPDATE_TIME, 0), be_const_int(750) }, - { be_const_key_weak(shadow_occupancy, 13), be_const_var(1) }, - { be_const_key_weak(ARG_TYPE, 7), be_const_static_closure(Matter_Plugin_Sensor_Occupancy__X3Clambda_X3E_closure) }, - { be_const_key_weak(TYPE, -1), be_nested_str_weak(occupancy) }, - { be_const_key_weak(UPDATE_COMMANDS, 3), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + { be_const_key_weak(read_attribute, 4), be_const_closure(Matter_Plugin_Sensor_Occupancy_read_attribute_closure) }, + { be_const_key_weak(TYPES, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(263, -1), be_const_int(2) }, + })) ) } )) }, + { be_const_key_weak(UPDATE_COMMANDS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { be_const_list( * be_nested_list(1, ( (struct bvalue*) &(const bvalue[]) { be_nested_str_weak(Occupancy), })) ) } )) }, - { be_const_key_weak(update_virtual, -1), be_const_closure(Matter_Plugin_Sensor_Occupancy_update_virtual_closure) }, + { be_const_key_weak(TYPE, 6), be_nested_str_weak(occupancy) }, + { be_const_key_weak(parse_configuration, -1), be_const_closure(Matter_Plugin_Sensor_Occupancy_parse_configuration_closure) }, + { be_const_key_weak(shadow_occupancy, -1), be_const_var(1) }, })), be_str_weak(Matter_Plugin_Sensor_Occupancy) );