From dcbb22a25617d4d6706dcdae588cf57eec84338c Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 3 Nov 2023 23:12:04 +0100 Subject: [PATCH] Matter improve virtual plugins (#19918) * Matter improve virtual plugins * Disable sensor probing for virtual * solidify --- .../src/embedded/Matter_Plugin_2_Sensor.be | 2 +- .../Matter_Plugin_2_Sensor_Contact.be | 23 ++-- .../Matter_Plugin_2_Sensor_Occupancy.be | 18 +-- .../embedded/Matter_Plugin_2_Sensor_OnOff.be | 18 +-- .../src/embedded/Matter_Plugin_2_Shutter.be | 10 +- .../src/embedded/Matter_Plugin_3_Light2.be | 24 ++-- .../solidified_Matter_Plugin_2_Sensor.h | 55 +++++----- ...olidified_Matter_Plugin_2_Sensor_Contact.h | 97 +++++++++-------- ...idified_Matter_Plugin_2_Sensor_Occupancy.h | 103 +++++++++--------- .../solidified_Matter_Plugin_2_Sensor_OnOff.h | 103 +++++++++--------- .../solidified_Matter_Plugin_2_Shutter.h | 65 +++++------ .../solidified_Matter_Plugin_3_Light2.h | 85 ++++++++------- 12 files changed, 319 insertions(+), 284 deletions(-) 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 bb44c91aa..cdeb53217 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 @@ -49,7 +49,7 @@ class Matter_Plugin_Sensor : Matter_Plugin_Device # The device calls regularly `tasmota.read_sensors()` and converts # it to json. def parse_sensors(payload) - if self.tasmota_sensor_matcher + if !self.VIRTUAL && self.tasmota_sensor_matcher var val = self.pre_value(real(self.tasmota_sensor_matcher.match(payload))) if val != nil if val != self.shadow_value 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 e4c847ead..5932b0060 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 @@ -60,18 +60,19 @@ class Matter_Plugin_Sensor_Contact : Matter_Plugin_Device # def update_shadow() super(self).update_shadow() + if !self.VIRTUAL + import json + var ret = tasmota.cmd("Status 8", true) + if ret != nil + var j = json.load(ret) + if j != nil + var state = false + state = (j.find("Switch" + str(self.tasmota_switch_index)) == "ON") - import json - var ret = tasmota.cmd("Status 8", true) - if ret != nil - var j = json.load(ret) - if j != nil - var state = false - state = (j.find("Switch" + str(self.tasmota_switch_index)) == "ON") - - if self.shadow_contact != state - self.attribute_updated(0x0045, 0x0000) - self.shadow_contact = state + if self.shadow_contact != state + self.attribute_updated(0x0045, 0x0000) + self.shadow_contact = state + end end end end 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 5d9d4f18c..8ad690726 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 @@ -60,17 +60,19 @@ class Matter_Plugin_Sensor_Occupancy : Matter_Plugin_Device # def update_shadow() super(self).update_shadow() - var switch_str = "Switch" + str(self.tasmota_switch_index) + if !self.VIRTUAL + var switch_str = "Switch" + str(self.tasmota_switch_index) - var j = tasmota.cmd("Status 8", true) - if j != nil j = j.find("StatusSNS") end - if j != nil && j.contains(switch_str) - var state = (j.find(switch_str) == "ON") + var j = tasmota.cmd("Status 8", true) + if j != nil j = j.find("StatusSNS") end + if j != nil && j.contains(switch_str) + var state = (j.find(switch_str) == "ON") - if (self.shadow_occupancy != state) - self.attribute_updated(0x0406, 0x0000) + if (self.shadow_occupancy != state) + self.attribute_updated(0x0406, 0x0000) + end + self.shadow_occupancy = state end - self.shadow_occupancy = state end end 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 79eb51c62..b7b1eb758 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 @@ -50,17 +50,19 @@ class Matter_Plugin_Sensor_OnOff : Matter_Plugin_Device # def update_shadow() super(self).update_shadow() - var switch_str = "Switch" + str(self.tasmota_switch_index) + if !self.VIRTUAL + var switch_str = "Switch" + str(self.tasmota_switch_index) - var j = tasmota.cmd("Status 8", true) - if j != nil j = j.find("StatusSNS") end - if j != nil && j.contains(switch_str) - var state = (j.find(switch_str) == "ON") + var j = tasmota.cmd("Status 8", true) + if j != nil j = j.find("StatusSNS") end + if j != nil && j.contains(switch_str) + var state = (j.find(switch_str) == "ON") - if (self.shadow_onoff != state) - self.attribute_updated(0x0006, 0x0000) + if (self.shadow_onoff != state) + self.attribute_updated(0x0006, 0x0000) + end + self.shadow_onoff = state end - self.shadow_onoff = state end end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be index 54e832f85..424f74be8 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be @@ -78,10 +78,12 @@ class Matter_Plugin_Shutter : Matter_Plugin_Device # Update shadow # def update_shadow() - self.update_inverted() - var sp = tasmota.cmd("ShutterPosition" + str(self.tasmota_shutter_index + 1), true) - if sp - self.parse_sensors(sp) + if !self.VIRTUAL + self.update_inverted() + var sp = tasmota.cmd("ShutterPosition" + str(self.tasmota_shutter_index + 1), true) + if sp + self.parse_sensors(sp) + end end super(self).update_shadow() end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light2.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light2.be index c4d4f9317..9bc4584d9 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light2.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light2.be @@ -61,17 +61,21 @@ class Matter_Plugin_Light2 : Matter_Plugin_Light1 # Update shadow # def update_shadow() - import light - self.update_ct_minmax() - super(self).update_shadow() - var light_status = light.get() - if light_status != nil - var ct = light_status.find('ct', nil) - if ct == nil ct = self.shadow_ct end - if ct != self.shadow_ct - self.attribute_updated(0x0300, 0x0007) - self.shadow_ct = ct + if !self.VIRTUAL + import light + self.update_ct_minmax() + super(self).update_shadow() + var light_status = light.get() + if light_status != nil + var ct = light_status.find('ct', nil) + if ct == nil ct = self.shadow_ct end + if ct != self.shadow_ct + self.attribute_updated(0x0300, 0x0007) + self.shadow_ct = ct + end end + else + super(self).update_shadow() end end 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 adb3bf9c8..2a86d3ae8 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 @@ -77,36 +77,39 @@ be_local_closure(Matter_Plugin_Sensor_parse_sensors, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota_sensor_matcher), - /* K1 */ be_nested_str_weak(pre_value), - /* K2 */ be_nested_str_weak(match), - /* K3 */ be_nested_str_weak(shadow_value), - /* K4 */ be_nested_str_weak(value_changed), + ( &(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[20]) { /* code */ + ( &(const binstruction[22]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x780A0010, // 0001 JMPF R2 #0013 - 0x8C080101, // 0002 GETMET R2 R0 K1 - 0x6010000A, // 0003 GETGBL R4 G10 - 0x88140100, // 0004 GETMBR R5 R0 K0 - 0x8C140B02, // 0005 GETMET R5 R5 K2 - 0x5C1C0200, // 0006 MOVE R7 R1 - 0x7C140400, // 0007 CALL R5 2 - 0x7C100200, // 0008 CALL R4 1 - 0x7C080400, // 0009 CALL R2 2 - 0x4C0C0000, // 000A LDNIL R3 - 0x200C0403, // 000B NE R3 R2 R3 - 0x780E0005, // 000C JMPF R3 #0013 - 0x880C0103, // 000D GETMBR R3 R0 K3 - 0x200C0403, // 000E NE R3 R2 R3 - 0x780E0002, // 000F JMPF R3 #0013 - 0x8C0C0104, // 0010 GETMET R3 R0 K4 - 0x7C0C0200, // 0011 CALL R3 1 - 0x90020602, // 0012 SETMBR R0 K3 R2 - 0x80000000, // 0013 RET 0 + 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 }) ) ); 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 2b98ba814..d097a5ba3 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 @@ -93,62 +93,65 @@ be_local_closure(Matter_Plugin_Sensor_Contact_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ + ( &(const bvalue[14]) { /* constants */ /* K0 */ be_nested_str_weak(update_shadow), - /* K1 */ be_nested_str_weak(json), - /* K2 */ be_nested_str_weak(tasmota), - /* K3 */ be_nested_str_weak(cmd), - /* K4 */ be_nested_str_weak(Status_X208), - /* K5 */ be_nested_str_weak(load), - /* K6 */ be_nested_str_weak(find), - /* K7 */ be_nested_str_weak(Switch), - /* K8 */ be_nested_str_weak(tasmota_switch_index), - /* K9 */ be_nested_str_weak(ON), - /* K10 */ be_nested_str_weak(shadow_contact), - /* K11 */ be_nested_str_weak(attribute_updated), - /* K12 */ be_const_int(0), + /* K1 */ be_nested_str_weak(VIRTUAL), + /* K2 */ be_nested_str_weak(json), + /* K3 */ be_nested_str_weak(tasmota), + /* K4 */ be_nested_str_weak(cmd), + /* K5 */ be_nested_str_weak(Status_X208), + /* K6 */ be_nested_str_weak(load), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(Switch), + /* K9 */ be_nested_str_weak(tasmota_switch_index), + /* K10 */ be_nested_str_weak(ON), + /* K11 */ be_nested_str_weak(shadow_contact), + /* K12 */ be_nested_str_weak(attribute_updated), + /* K13 */ be_const_int(0), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[38]) { /* code */ + ( &(const binstruction[40]) { /* code */ 0x60040003, // 0000 GETGBL R1 G3 0x5C080000, // 0001 MOVE R2 R0 0x7C040200, // 0002 CALL R1 1 0x8C040300, // 0003 GETMET R1 R1 K0 0x7C040200, // 0004 CALL R1 1 - 0xA4060200, // 0005 IMPORT R1 K1 - 0xB80A0400, // 0006 GETNGBL R2 K2 - 0x8C080503, // 0007 GETMET R2 R2 K3 - 0x58100004, // 0008 LDCONST R4 K4 - 0x50140200, // 0009 LDBOOL R5 1 0 - 0x7C080600, // 000A CALL R2 3 - 0x4C0C0000, // 000B LDNIL R3 - 0x200C0403, // 000C NE R3 R2 R3 - 0x780E0016, // 000D JMPF R3 #0025 - 0x8C0C0305, // 000E GETMET R3 R1 K5 - 0x5C140400, // 000F MOVE R5 R2 - 0x7C0C0400, // 0010 CALL R3 2 - 0x4C100000, // 0011 LDNIL R4 - 0x20100604, // 0012 NE R4 R3 R4 - 0x78120010, // 0013 JMPF R4 #0025 - 0x50100000, // 0014 LDBOOL R4 0 0 - 0x8C140706, // 0015 GETMET R5 R3 K6 - 0x601C0008, // 0016 GETGBL R7 G8 - 0x88200108, // 0017 GETMBR R8 R0 K8 - 0x7C1C0200, // 0018 CALL R7 1 - 0x001E0E07, // 0019 ADD R7 K7 R7 - 0x7C140400, // 001A CALL R5 2 - 0x1C140B09, // 001B EQ R5 R5 K9 - 0x5C100A00, // 001C MOVE R4 R5 - 0x8814010A, // 001D GETMBR R5 R0 K10 - 0x20140A04, // 001E NE R5 R5 R4 - 0x78160004, // 001F JMPF R5 #0025 - 0x8C14010B, // 0020 GETMET R5 R0 K11 - 0x541E0044, // 0021 LDINT R7 69 - 0x5820000C, // 0022 LDCONST R8 K12 - 0x7C140600, // 0023 CALL R5 3 - 0x90021404, // 0024 SETMBR R0 K10 R4 - 0x80000000, // 0025 RET 0 + 0x88040101, // 0005 GETMBR R1 R0 K1 + 0x7406001F, // 0006 JMPT R1 #0027 + 0xA4060400, // 0007 IMPORT R1 K2 + 0xB80A0600, // 0008 GETNGBL R2 K3 + 0x8C080504, // 0009 GETMET R2 R2 K4 + 0x58100005, // 000A LDCONST R4 K5 + 0x50140200, // 000B LDBOOL R5 1 0 + 0x7C080600, // 000C CALL R2 3 + 0x4C0C0000, // 000D LDNIL R3 + 0x200C0403, // 000E NE R3 R2 R3 + 0x780E0016, // 000F JMPF R3 #0027 + 0x8C0C0306, // 0010 GETMET R3 R1 K6 + 0x5C140400, // 0011 MOVE R5 R2 + 0x7C0C0400, // 0012 CALL R3 2 + 0x4C100000, // 0013 LDNIL R4 + 0x20100604, // 0014 NE R4 R3 R4 + 0x78120010, // 0015 JMPF R4 #0027 + 0x50100000, // 0016 LDBOOL R4 0 0 + 0x8C140707, // 0017 GETMET R5 R3 K7 + 0x601C0008, // 0018 GETGBL R7 G8 + 0x88200109, // 0019 GETMBR R8 R0 K9 + 0x7C1C0200, // 001A CALL R7 1 + 0x001E1007, // 001B ADD R7 K8 R7 + 0x7C140400, // 001C CALL R5 2 + 0x1C140B0A, // 001D EQ R5 R5 K10 + 0x5C100A00, // 001E MOVE R4 R5 + 0x8814010B, // 001F GETMBR R5 R0 K11 + 0x20140A04, // 0020 NE R5 R5 R4 + 0x78160004, // 0021 JMPF R5 #0027 + 0x8C14010C, // 0022 GETMET R5 R0 K12 + 0x541E0044, // 0023 LDINT R7 69 + 0x5820000D, // 0024 LDCONST R8 K13 + 0x7C140600, // 0025 CALL R5 3 + 0x90021604, // 0026 SETMBR R0 K11 R4 + 0x80000000, // 0027 RET 0 }) ) ); 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 60c934fd1..d49d927cc 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 @@ -93,65 +93,68 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ + ( &(const bvalue[14]) { /* constants */ /* K0 */ be_nested_str_weak(update_shadow), - /* K1 */ be_nested_str_weak(Switch), - /* K2 */ be_nested_str_weak(tasmota_switch_index), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(cmd), - /* K5 */ be_nested_str_weak(Status_X208), - /* K6 */ be_nested_str_weak(find), - /* K7 */ be_nested_str_weak(StatusSNS), - /* K8 */ be_nested_str_weak(contains), - /* K9 */ be_nested_str_weak(ON), - /* K10 */ be_nested_str_weak(shadow_occupancy), - /* K11 */ be_nested_str_weak(attribute_updated), - /* K12 */ be_const_int(0), + /* K1 */ be_nested_str_weak(VIRTUAL), + /* K2 */ be_nested_str_weak(Switch), + /* K3 */ be_nested_str_weak(tasmota_switch_index), + /* K4 */ be_nested_str_weak(tasmota), + /* K5 */ be_nested_str_weak(cmd), + /* K6 */ be_nested_str_weak(Status_X208), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(StatusSNS), + /* K9 */ be_nested_str_weak(contains), + /* K10 */ be_nested_str_weak(ON), + /* K11 */ be_nested_str_weak(shadow_occupancy), + /* K12 */ be_nested_str_weak(attribute_updated), + /* K13 */ be_const_int(0), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[41]) { /* code */ + ( &(const binstruction[43]) { /* code */ 0x60040003, // 0000 GETGBL R1 G3 0x5C080000, // 0001 MOVE R2 R0 0x7C040200, // 0002 CALL R1 1 0x8C040300, // 0003 GETMET R1 R1 K0 0x7C040200, // 0004 CALL R1 1 - 0x60040008, // 0005 GETGBL R1 G8 - 0x88080102, // 0006 GETMBR R2 R0 K2 - 0x7C040200, // 0007 CALL R1 1 - 0x00060201, // 0008 ADD R1 K1 R1 - 0xB80A0600, // 0009 GETNGBL R2 K3 - 0x8C080504, // 000A GETMET R2 R2 K4 - 0x58100005, // 000B LDCONST R4 K5 - 0x50140200, // 000C LDBOOL R5 1 0 - 0x7C080600, // 000D CALL R2 3 - 0x4C0C0000, // 000E LDNIL R3 - 0x200C0403, // 000F NE R3 R2 R3 - 0x780E0003, // 0010 JMPF R3 #0015 - 0x8C0C0506, // 0011 GETMET R3 R2 K6 - 0x58140007, // 0012 LDCONST R5 K7 - 0x7C0C0400, // 0013 CALL R3 2 - 0x5C080600, // 0014 MOVE R2 R3 - 0x4C0C0000, // 0015 LDNIL R3 - 0x200C0403, // 0016 NE R3 R2 R3 - 0x780E000F, // 0017 JMPF R3 #0028 - 0x8C0C0508, // 0018 GETMET R3 R2 K8 - 0x5C140200, // 0019 MOVE R5 R1 - 0x7C0C0400, // 001A CALL R3 2 - 0x780E000B, // 001B JMPF R3 #0028 - 0x8C0C0506, // 001C GETMET R3 R2 K6 - 0x5C140200, // 001D MOVE R5 R1 - 0x7C0C0400, // 001E CALL R3 2 - 0x1C0C0709, // 001F EQ R3 R3 K9 - 0x8810010A, // 0020 GETMBR R4 R0 K10 - 0x20100803, // 0021 NE R4 R4 R3 - 0x78120003, // 0022 JMPF R4 #0027 - 0x8C10010B, // 0023 GETMET R4 R0 K11 - 0x541A0405, // 0024 LDINT R6 1030 - 0x581C000C, // 0025 LDCONST R7 K12 - 0x7C100600, // 0026 CALL R4 3 - 0x90021403, // 0027 SETMBR R0 K10 R3 - 0x80000000, // 0028 RET 0 + 0x88040101, // 0005 GETMBR R1 R0 K1 + 0x74060022, // 0006 JMPT R1 #002A + 0x60040008, // 0007 GETGBL R1 G8 + 0x88080103, // 0008 GETMBR R2 R0 K3 + 0x7C040200, // 0009 CALL R1 1 + 0x00060401, // 000A ADD R1 K2 R1 + 0xB80A0800, // 000B GETNGBL R2 K4 + 0x8C080505, // 000C GETMET R2 R2 K5 + 0x58100006, // 000D LDCONST R4 K6 + 0x50140200, // 000E LDBOOL R5 1 0 + 0x7C080600, // 000F CALL R2 3 + 0x4C0C0000, // 0010 LDNIL R3 + 0x200C0403, // 0011 NE R3 R2 R3 + 0x780E0003, // 0012 JMPF R3 #0017 + 0x8C0C0507, // 0013 GETMET R3 R2 K7 + 0x58140008, // 0014 LDCONST R5 K8 + 0x7C0C0400, // 0015 CALL R3 2 + 0x5C080600, // 0016 MOVE R2 R3 + 0x4C0C0000, // 0017 LDNIL R3 + 0x200C0403, // 0018 NE R3 R2 R3 + 0x780E000F, // 0019 JMPF R3 #002A + 0x8C0C0509, // 001A GETMET R3 R2 K9 + 0x5C140200, // 001B MOVE R5 R1 + 0x7C0C0400, // 001C CALL R3 2 + 0x780E000B, // 001D JMPF R3 #002A + 0x8C0C0507, // 001E GETMET R3 R2 K7 + 0x5C140200, // 001F MOVE R5 R1 + 0x7C0C0400, // 0020 CALL R3 2 + 0x1C0C070A, // 0021 EQ R3 R3 K10 + 0x8810010B, // 0022 GETMBR R4 R0 K11 + 0x20100803, // 0023 NE R4 R4 R3 + 0x78120003, // 0024 JMPF R4 #0029 + 0x8C10010C, // 0025 GETMET R4 R0 K12 + 0x541A0405, // 0026 LDINT R6 1030 + 0x581C000D, // 0027 LDCONST R7 K13 + 0x7C100600, // 0028 CALL R4 3 + 0x90021603, // 0029 SETMBR R0 K11 R3 + 0x80000000, // 002A RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h index 498676bf4..b0847cd19 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h @@ -46,65 +46,68 @@ be_local_closure(Matter_Plugin_Sensor_OnOff_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ + ( &(const bvalue[14]) { /* constants */ /* K0 */ be_nested_str_weak(update_shadow), - /* K1 */ be_nested_str_weak(Switch), - /* K2 */ be_nested_str_weak(tasmota_switch_index), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(cmd), - /* K5 */ be_nested_str_weak(Status_X208), - /* K6 */ be_nested_str_weak(find), - /* K7 */ be_nested_str_weak(StatusSNS), - /* K8 */ be_nested_str_weak(contains), - /* K9 */ be_nested_str_weak(ON), - /* K10 */ be_nested_str_weak(shadow_onoff), - /* K11 */ be_nested_str_weak(attribute_updated), - /* K12 */ be_const_int(0), + /* K1 */ be_nested_str_weak(VIRTUAL), + /* K2 */ be_nested_str_weak(Switch), + /* K3 */ be_nested_str_weak(tasmota_switch_index), + /* K4 */ be_nested_str_weak(tasmota), + /* K5 */ be_nested_str_weak(cmd), + /* K6 */ be_nested_str_weak(Status_X208), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(StatusSNS), + /* K9 */ be_nested_str_weak(contains), + /* K10 */ be_nested_str_weak(ON), + /* K11 */ be_nested_str_weak(shadow_onoff), + /* K12 */ be_nested_str_weak(attribute_updated), + /* K13 */ be_const_int(0), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[41]) { /* code */ + ( &(const binstruction[43]) { /* code */ 0x60040003, // 0000 GETGBL R1 G3 0x5C080000, // 0001 MOVE R2 R0 0x7C040200, // 0002 CALL R1 1 0x8C040300, // 0003 GETMET R1 R1 K0 0x7C040200, // 0004 CALL R1 1 - 0x60040008, // 0005 GETGBL R1 G8 - 0x88080102, // 0006 GETMBR R2 R0 K2 - 0x7C040200, // 0007 CALL R1 1 - 0x00060201, // 0008 ADD R1 K1 R1 - 0xB80A0600, // 0009 GETNGBL R2 K3 - 0x8C080504, // 000A GETMET R2 R2 K4 - 0x58100005, // 000B LDCONST R4 K5 - 0x50140200, // 000C LDBOOL R5 1 0 - 0x7C080600, // 000D CALL R2 3 - 0x4C0C0000, // 000E LDNIL R3 - 0x200C0403, // 000F NE R3 R2 R3 - 0x780E0003, // 0010 JMPF R3 #0015 - 0x8C0C0506, // 0011 GETMET R3 R2 K6 - 0x58140007, // 0012 LDCONST R5 K7 - 0x7C0C0400, // 0013 CALL R3 2 - 0x5C080600, // 0014 MOVE R2 R3 - 0x4C0C0000, // 0015 LDNIL R3 - 0x200C0403, // 0016 NE R3 R2 R3 - 0x780E000F, // 0017 JMPF R3 #0028 - 0x8C0C0508, // 0018 GETMET R3 R2 K8 - 0x5C140200, // 0019 MOVE R5 R1 - 0x7C0C0400, // 001A CALL R3 2 - 0x780E000B, // 001B JMPF R3 #0028 - 0x8C0C0506, // 001C GETMET R3 R2 K6 - 0x5C140200, // 001D MOVE R5 R1 - 0x7C0C0400, // 001E CALL R3 2 - 0x1C0C0709, // 001F EQ R3 R3 K9 - 0x8810010A, // 0020 GETMBR R4 R0 K10 - 0x20100803, // 0021 NE R4 R4 R3 - 0x78120003, // 0022 JMPF R4 #0027 - 0x8C10010B, // 0023 GETMET R4 R0 K11 - 0x541A0005, // 0024 LDINT R6 6 - 0x581C000C, // 0025 LDCONST R7 K12 - 0x7C100600, // 0026 CALL R4 3 - 0x90021403, // 0027 SETMBR R0 K10 R3 - 0x80000000, // 0028 RET 0 + 0x88040101, // 0005 GETMBR R1 R0 K1 + 0x74060022, // 0006 JMPT R1 #002A + 0x60040008, // 0007 GETGBL R1 G8 + 0x88080103, // 0008 GETMBR R2 R0 K3 + 0x7C040200, // 0009 CALL R1 1 + 0x00060401, // 000A ADD R1 K2 R1 + 0xB80A0800, // 000B GETNGBL R2 K4 + 0x8C080505, // 000C GETMET R2 R2 K5 + 0x58100006, // 000D LDCONST R4 K6 + 0x50140200, // 000E LDBOOL R5 1 0 + 0x7C080600, // 000F CALL R2 3 + 0x4C0C0000, // 0010 LDNIL R3 + 0x200C0403, // 0011 NE R3 R2 R3 + 0x780E0003, // 0012 JMPF R3 #0017 + 0x8C0C0507, // 0013 GETMET R3 R2 K7 + 0x58140008, // 0014 LDCONST R5 K8 + 0x7C0C0400, // 0015 CALL R3 2 + 0x5C080600, // 0016 MOVE R2 R3 + 0x4C0C0000, // 0017 LDNIL R3 + 0x200C0403, // 0018 NE R3 R2 R3 + 0x780E000F, // 0019 JMPF R3 #002A + 0x8C0C0509, // 001A GETMET R3 R2 K9 + 0x5C140200, // 001B MOVE R5 R1 + 0x7C0C0400, // 001C CALL R3 2 + 0x780E000B, // 001D JMPF R3 #002A + 0x8C0C0507, // 001E GETMET R3 R2 K7 + 0x5C140200, // 001F MOVE R5 R1 + 0x7C0C0400, // 0020 CALL R3 2 + 0x1C0C070A, // 0021 EQ R3 R3 K10 + 0x8810010B, // 0022 GETMBR R4 R0 K11 + 0x20100803, // 0023 NE R4 R4 R3 + 0x78120003, // 0024 JMPF R4 #0029 + 0x8C10010C, // 0025 GETMET R4 R0 K12 + 0x541A0005, // 0026 LDINT R6 6 + 0x581C000D, // 0027 LDCONST R7 K13 + 0x7C100600, // 0028 CALL R4 3 + 0x90021603, // 0029 SETMBR R0 K11 R3 + 0x80000000, // 002A RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h index 30f6d8348..16c73a9ed 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h @@ -606,40 +606,43 @@ be_local_closure(Matter_Plugin_Shutter_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(update_inverted), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(cmd), - /* K3 */ be_nested_str_weak(ShutterPosition), - /* K4 */ be_nested_str_weak(tasmota_shutter_index), - /* K5 */ be_const_int(1), - /* K6 */ be_nested_str_weak(parse_sensors), - /* K7 */ be_nested_str_weak(update_shadow), + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(update_inverted), + /* K2 */ be_nested_str_weak(tasmota), + /* K3 */ be_nested_str_weak(cmd), + /* K4 */ be_nested_str_weak(ShutterPosition), + /* K5 */ be_nested_str_weak(tasmota_shutter_index), + /* K6 */ be_const_int(1), + /* K7 */ be_nested_str_weak(parse_sensors), + /* K8 */ be_nested_str_weak(update_shadow), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[21]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0xB8060200, // 0002 GETNGBL R1 K1 - 0x8C040302, // 0003 GETMET R1 R1 K2 - 0x600C0008, // 0004 GETGBL R3 G8 - 0x88100104, // 0005 GETMBR R4 R0 K4 - 0x00100905, // 0006 ADD R4 R4 K5 - 0x7C0C0200, // 0007 CALL R3 1 - 0x000E0603, // 0008 ADD R3 K3 R3 - 0x50100200, // 0009 LDBOOL R4 1 0 - 0x7C040600, // 000A CALL R1 3 - 0x78060002, // 000B JMPF R1 #000F - 0x8C080106, // 000C GETMET R2 R0 K6 - 0x5C100200, // 000D MOVE R4 R1 - 0x7C080400, // 000E CALL R2 2 - 0x60080003, // 000F GETGBL R2 G3 - 0x5C0C0000, // 0010 MOVE R3 R0 - 0x7C080200, // 0011 CALL R2 1 - 0x8C080507, // 0012 GETMET R2 R2 K7 - 0x7C080200, // 0013 CALL R2 1 - 0x80000000, // 0014 RET 0 + ( &(const binstruction[23]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x7406000E, // 0001 JMPT R1 #0011 + 0x8C040101, // 0002 GETMET R1 R0 K1 + 0x7C040200, // 0003 CALL R1 1 + 0xB8060400, // 0004 GETNGBL R1 K2 + 0x8C040303, // 0005 GETMET R1 R1 K3 + 0x600C0008, // 0006 GETGBL R3 G8 + 0x88100105, // 0007 GETMBR R4 R0 K5 + 0x00100906, // 0008 ADD R4 R4 K6 + 0x7C0C0200, // 0009 CALL R3 1 + 0x000E0803, // 000A ADD R3 K4 R3 + 0x50100200, // 000B LDBOOL R4 1 0 + 0x7C040600, // 000C CALL R1 3 + 0x78060002, // 000D JMPF R1 #0011 + 0x8C080107, // 000E GETMET R2 R0 K7 + 0x5C100200, // 000F MOVE R4 R1 + 0x7C080400, // 0010 CALL R2 2 + 0x60040003, // 0011 GETGBL R1 G3 + 0x5C080000, // 0012 MOVE R2 R0 + 0x7C040200, // 0013 CALL R1 1 + 0x8C040308, // 0014 GETMET R1 R1 K8 + 0x7C040200, // 0015 CALL R1 1 + 0x80000000, // 0016 RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light2.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light2.h index 623e34ed5..8f157b0f3 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light2.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light2.h @@ -156,49 +156,58 @@ be_local_closure(Matter_Plugin_Light2_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(light), - /* K1 */ be_nested_str_weak(update_ct_minmax), - /* K2 */ be_nested_str_weak(update_shadow), - /* K3 */ be_nested_str_weak(get), - /* K4 */ be_nested_str_weak(find), - /* K5 */ be_nested_str_weak(ct), - /* K6 */ be_nested_str_weak(shadow_ct), - /* K7 */ be_nested_str_weak(attribute_updated), + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(light), + /* K2 */ be_nested_str_weak(update_ct_minmax), + /* K3 */ be_nested_str_weak(update_shadow), + /* K4 */ be_nested_str_weak(get), + /* K5 */ be_nested_str_weak(find), + /* K6 */ be_nested_str_weak(ct), + /* K7 */ be_nested_str_weak(shadow_ct), + /* K8 */ be_nested_str_weak(attribute_updated), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[30]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x8C080101, // 0001 GETMET R2 R0 K1 - 0x7C080200, // 0002 CALL R2 1 - 0x60080003, // 0003 GETGBL R2 G3 - 0x5C0C0000, // 0004 MOVE R3 R0 - 0x7C080200, // 0005 CALL R2 1 - 0x8C080502, // 0006 GETMET R2 R2 K2 + ( &(const binstruction[38]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x7406001D, // 0001 JMPT R1 #0020 + 0xA4060200, // 0002 IMPORT R1 K1 + 0x8C080102, // 0003 GETMET R2 R0 K2 + 0x7C080200, // 0004 CALL R2 1 + 0x60080003, // 0005 GETGBL R2 G3 + 0x5C0C0000, // 0006 MOVE R3 R0 0x7C080200, // 0007 CALL R2 1 - 0x8C080303, // 0008 GETMET R2 R1 K3 + 0x8C080503, // 0008 GETMET R2 R2 K3 0x7C080200, // 0009 CALL R2 1 - 0x4C0C0000, // 000A LDNIL R3 - 0x200C0403, // 000B NE R3 R2 R3 - 0x780E000F, // 000C JMPF R3 #001D - 0x8C0C0504, // 000D GETMET R3 R2 K4 - 0x58140005, // 000E LDCONST R5 K5 - 0x4C180000, // 000F LDNIL R6 - 0x7C0C0600, // 0010 CALL R3 3 - 0x4C100000, // 0011 LDNIL R4 - 0x1C100604, // 0012 EQ R4 R3 R4 - 0x78120000, // 0013 JMPF R4 #0015 - 0x880C0106, // 0014 GETMBR R3 R0 K6 - 0x88100106, // 0015 GETMBR R4 R0 K6 - 0x20100604, // 0016 NE R4 R3 R4 - 0x78120004, // 0017 JMPF R4 #001D - 0x8C100107, // 0018 GETMET R4 R0 K7 - 0x541A02FF, // 0019 LDINT R6 768 - 0x541E0006, // 001A LDINT R7 7 - 0x7C100600, // 001B CALL R4 3 - 0x90020C03, // 001C SETMBR R0 K6 R3 - 0x80000000, // 001D RET 0 + 0x8C080304, // 000A GETMET R2 R1 K4 + 0x7C080200, // 000B CALL R2 1 + 0x4C0C0000, // 000C LDNIL R3 + 0x200C0403, // 000D NE R3 R2 R3 + 0x780E000F, // 000E JMPF R3 #001F + 0x8C0C0505, // 000F GETMET R3 R2 K5 + 0x58140006, // 0010 LDCONST R5 K6 + 0x4C180000, // 0011 LDNIL R6 + 0x7C0C0600, // 0012 CALL R3 3 + 0x4C100000, // 0013 LDNIL R4 + 0x1C100604, // 0014 EQ R4 R3 R4 + 0x78120000, // 0015 JMPF R4 #0017 + 0x880C0107, // 0016 GETMBR R3 R0 K7 + 0x88100107, // 0017 GETMBR R4 R0 K7 + 0x20100604, // 0018 NE R4 R3 R4 + 0x78120004, // 0019 JMPF R4 #001F + 0x8C100108, // 001A GETMET R4 R0 K8 + 0x541A02FF, // 001B LDINT R6 768 + 0x541E0006, // 001C LDINT R7 7 + 0x7C100600, // 001D CALL R4 3 + 0x90020E03, // 001E SETMBR R0 K7 R3 + 0x70020004, // 001F JMP #0025 + 0x60040003, // 0020 GETGBL R1 G3 + 0x5C080000, // 0021 MOVE R2 R0 + 0x7C040200, // 0022 CALL R1 1 + 0x8C040303, // 0023 GETMET R1 R1 K3 + 0x7C040200, // 0024 CALL R1 1 + 0x80000000, // 0025 RET 0 }) ) );