diff --git a/lib/libesp32/berry_matter/src/be_matter_module.c b/lib/libesp32/berry_matter/src/be_matter_module.c index 56e9d51d4..9e9412854 100644 --- a/lib/libesp32/berry_matter/src/be_matter_module.c +++ b/lib/libesp32/berry_matter/src/be_matter_module.c @@ -226,7 +226,9 @@ extern const bclass be_class_Matter_TLV; // need to declare it upfront because #include "solidify/solidified_Matter_Plugin_3_ShutterTilt.h" #include "solidify/solidified_Matter_Plugin_2_Sensor.h" #include "solidify/solidified_Matter_Plugin_3_Sensor_Pressure.h" +#include "solidify/solidified_Matter_Plugin_3_Sensor_Flow.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Pressure.h" +#include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h" #include "solidify/solidified_Matter_Plugin_3_Sensor_Temp.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Temp.h" #include "solidify/solidified_Matter_Plugin_3_Sensor_Illuminance.h" @@ -251,6 +253,7 @@ extern const bclass be_class_Matter_TLV; // need to declare it upfront because #include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Humidity.h" #include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Occupancy.h" #include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Contact.h" +#include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h" /*********************************************************************************************\ * Get a bytes() object of the certificate DAC/PAI_Cert @@ -448,7 +451,9 @@ module matter (scope: global, strings: weak) { Plugin_ShutterTilt, class(be_class_Matter_Plugin_ShutterTilt) // Shutter + Tilt Plugin_Sensor, class(be_class_Matter_Plugin_Sensor) // Generic Sensor Plugin_Sensor_Pressure, class(be_class_Matter_Plugin_Sensor_Pressure) // Pressure Sensor + Plugin_Sensor_Flow, class(be_class_Matter_Plugin_Sensor_Flow) // Flow Sensor Plugin_Sensor_Virt_Pressure, class(be_class_Matter_Plugin_Virt_Sensor_Pressure) // Pressure Virtual Sensor + Plugin_Sensor_Virt_Flow, class(be_class_Matter_Plugin_Virt_Sensor_Flow) // Flow Virtual Sensor Plugin_Sensor_Temp, class(be_class_Matter_Plugin_Sensor_Temp) // Temperature Sensor Plugin_Virt_Sensor_Temp, class(be_class_Matter_Plugin_Virt_Sensor_Temp) // Temperature Sensor Plugin_Sensor_Illuminance, class(be_class_Matter_Plugin_Sensor_Illuminance) // Illuminance Sensor @@ -468,6 +473,7 @@ module matter (scope: global, strings: weak) { Plugin_Bridge_Light3, class(be_class_Matter_Plugin_Bridge_Light3) // HTTP RGB Light Plugin_Bridge_Sensor, class(be_class_Matter_Plugin_Bridge_Sensor) // HTTP generic sensor Plugin_Bridge_Sensor_Pressure, class(be_class_Matter_Plugin_Bridge_Sensor_Pressure) // HTTP Pressure sensor + Plugin_Bridge_Sensor_Flow, class(be_class_Matter_Plugin_Bridge_Sensor_Flow) // HTTP Flow sensor Plugin_Bridge_Sensor_Temp, class(be_class_Matter_Plugin_Bridge_Sensor_Temp) // HTTP Temperature sensor Plugin_Bridge_Sensor_Illuminance, class(be_class_Matter_Plugin_Bridge_Sensor_Illuminance) // HTTP Illuminance sensor Plugin_Bridge_Sensor_Humidity, class(be_class_Matter_Plugin_Bridge_Sensor_Humidity) // HTTP Humidity sensor diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Flow.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Flow.be new file mode 100644 index 000000000..2d0ed3f15 --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Flow.be @@ -0,0 +1,86 @@ +# +# Matter_Plugin_Sensor_Flow.be - implements the behavior for a Flow Sensor +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Sensor_Flow,weak + +class Matter_Plugin_Sensor_Flow : Matter_Plugin_Sensor + static var TYPE = "flow" # name of the plug-in in json + static var DISPLAY_NAME = "Flow" # display name of the plug-in + static var JSON_NAME = "Flow" # Name of the sensor attribute in JSON payloads + static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Flow") + static var CLUSTERS = matter.consolidate_clusters(_class, { + 0x0404: [0,1,2,0xFFFC,0xFFFD], # Flow Measurement + }) + static var TYPES = { 0x0306: 2 } # Flow Sensor, rev 2 + + ############################################################# + # Pre-process value + # + # This must be overriden. + # This allows to convert the raw sensor value to the target one, typically int + def pre_value(val) + return val != nil ? int(val) : nil + end + + ############################################################# + # Called when the value changed compared to shadow value + # + # This must be overriden. + # This is where you call `self.attribute_updated(, )` + def value_changed() + self.attribute_updated(0x0404, 0x0000) + end + + ############################################################# + # read an attribute + # + def read_attribute(session, ctx, tlv_solo) + var TLV = matter.TLV + var cluster = ctx.cluster + var attribute = ctx.attribute + + # ==================================================================================================== + if cluster == 0x0404 # ========== Flow Measurement 2.4 p.98 ========== + if attribute == 0x0000 # ---------- MeasuredValue / i16 ---------- + if self.shadow_value != nil + return tlv_solo.set(TLV.I2, int(self.shadow_value)) # MeasuredValue represents the flow in m3/h + else + return tlv_solo.set(TLV.NULL, nil) + end + elif attribute == 0x0001 # ---------- MinMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.I2, 0) # 500 m3/h + elif attribute == 0x0002 # ---------- MaxMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.I2, 65534) # 65534 m3/h + elif attribute == 0xFFFC # ---------- FeatureMap / map32 ---------- + return tlv_solo.set(TLV.U4, 0) # 0 = no Extended Range + elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ---------- + return tlv_solo.set(TLV.U4, 3) # 3 = New data model format and notation + end + + else + return super(self).read_attribute(session, ctx, tlv_solo) + end + end + +end +matter.Plugin_Sensor_Flow = Matter_Plugin_Sensor_Flow diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Flow.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Flow.be new file mode 100644 index 000000000..1ad39e29a --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Flow.be @@ -0,0 +1,96 @@ +# +# Matter_Plugin_Bridge_Sensor_Flow.be - implements base class for a Flow Sensor via HTTP to Tasmota +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Bridge_Sensor_Flow,weak + +class Matter_Plugin_Bridge_Sensor_Flow : Matter_Plugin_Bridge_Sensor + static var TYPE = "http_flow" # name of the plug-in in json + static var DISPLAY_NAME = "Flow" # display name of the plug-in + + static var CLUSTERS = matter.consolidate_clusters(_class, { + 0x0404: [0,1,2,0xFFFC,0xFFFD], # Flow Measurement + }) + static var TYPES = { 0x0306: 2 } # Flow Sensor, rev 2 + + ############################################################# + # Called when the value changed compared to shadow value + # + # This must be overriden. + # This is where you call `self.attribute_updated(, )` + def value_changed() + self.attribute_updated(0x0404, 0x0000) + end + + ############################################################# + # Pre-process value + # + # This must be overriden. + # This allows to convert the raw sensor value to the target one, typically int + def pre_value(val) + return val != nil ? int(val) : nil + end + + ############################################################# + # read an attribute + # + def read_attribute(session, ctx, tlv_solo) + var TLV = matter.TLV + var cluster = ctx.cluster + var attribute = ctx.attribute + + # ==================================================================================================== + if cluster == 0x0404 # ========== Flow Measurement 2.1.2 p.127 ========== + if attribute == 0x0000 # ---------- MeasuredValue / i16 ---------- + if self.shadow_value != nil + return tlv_solo.set(TLV.I2, int(self.shadow_value)) # MeasuredValue represents the flow in m3/h + else + return tlv_solo.set(TLV.NULL, nil) + end + elif attribute == 0x0001 # ---------- MinMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.I2, 0) # 500 m3/h + elif attribute == 0x0002 # ---------- MaxMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.I2, 65534) # 65534 m3/h + elif attribute == 0xFFFC # ---------- FeatureMap / map32 ---------- + return tlv_solo.set(TLV.U4, 0) # 0 = no Extended Range + elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ---------- + return tlv_solo.set(TLV.U4, 3) # 3 = New data model format and notation + end + + else + return super(self).read_attribute(session, ctx, tlv_solo) + end + end + + ############################################################# + # web_values + # + # Show values of the remote device as HTML + def web_values() + import webserver + self.web_values_prefix() # display '| ' and name if present + webserver.content_send(format("⛅ %i m3/h", + int(self.shadow_value))) + end + +end +matter.Plugin_Bridge_Sensor_Flow = Matter_Plugin_Bridge_Sensor_Flow diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Flow.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Flow.be new file mode 100644 index 000000000..e915ab77e --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Flow.be @@ -0,0 +1,34 @@ +# +# Matter_Plugin_9_Virt_Sensor_Flow.be - implements the behavior for a Flow Sensor +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Virt_Sensor_Flow,weak + +class Matter_Plugin_Virt_Sensor_Flow : Matter_Plugin_Sensor_Flow + static var TYPE = "v_flow" # name of the plug-in in json + static var DISPLAY_NAME = "v.Flow" # display name of the plug-in + static var ARG = "" # no arg for virtual device + static var ARG_HINT = "_Not used_" # Hint for entering the Argument (inside 'placeholder') + static var VIRTUAL = true # virtual device + +end +matter.Plugin_Virt_Sensor_Flow = Matter_Plugin_Virt_Sensor_Flow diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_UI.be b/lib/libesp32/berry_matter/src/embedded/Matter_UI.be index b600fd41f..a8b372f2c 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_UI.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_UI.be @@ -33,13 +33,13 @@ import matter ################################################################################# class Matter_UI static var _CLASSES_TYPES = "|relay|light0|light1|light2|light3|shutter|shutter+tilt" - "|temperature|pressure|illuminance|humidity|occupancy|onoff|contact" + "|temperature|pressure|illuminance|humidity|occupancy|onoff|contact|flow" "|-virtual|v_relay|v_light0|v_light1|v_light2|v_light3" - "|v_temp|v_pressure|v_illuminance|v_humidity|v_occupancy|v_contact" + "|v_temp|v_pressure|v_illuminance|v_humidity|v_occupancy|v_contact|v_flow" # static var _CLASSES_HTTP = "-http" static var _CLASSES_TYPES2= "|http_relay|http_light0|http_light1|http_light2|http_light3" "|http_temperature|http_pressure|http_illuminance|http_humidity" - "|http_occupancy|http_contact" + "|http_occupancy|http_contact|http_flow" var device # #################################################################################################### diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Flow.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Flow.h new file mode 100644 index 000000000..49b225cc2 --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Flow.h @@ -0,0 +1,278 @@ +/* Solidification of Matter_Plugin_3_Sensor_Flow.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Sensor_Flow; + +/******************************************************************** +** Solidified function: value_changed +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Flow_value_changed, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* 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(attribute_updated), + /* K1 */ be_const_int(0), + }), + be_str_weak(value_changed), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0403, // 0001 LDINT R3 1028 + 0x58100001, // 0002 LDCONST R4 K1 + 0x7C040600, // 0003 CALL R1 3 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read_attribute +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Flow_read_attribute, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[14]) { /* constants */ + /* K0 */ be_nested_str_weak(matter), + /* K1 */ be_nested_str_weak(TLV), + /* K2 */ be_nested_str_weak(cluster), + /* K3 */ be_nested_str_weak(attribute), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(shadow_value), + /* K6 */ be_nested_str_weak(set), + /* K7 */ be_nested_str_weak(I2), + /* K8 */ be_nested_str_weak(NULL), + /* K9 */ be_const_int(1), + /* K10 */ be_const_int(2), + /* K11 */ be_nested_str_weak(U4), + /* K12 */ be_const_int(3), + /* K13 */ be_nested_str_weak(read_attribute), + }), + be_str_weak(read_attribute), + &be_const_str_solidified, + ( &(const binstruction[71]) { /* code */ + 0xB8120000, // 0000 GETNGBL R4 K0 + 0x88100901, // 0001 GETMBR R4 R4 K1 + 0x88140502, // 0002 GETMBR R5 R2 K2 + 0x88180503, // 0003 GETMBR R6 R2 K3 + 0x541E0403, // 0004 LDINT R7 1028 + 0x1C1C0A07, // 0005 EQ R7 R5 R7 + 0x781E0035, // 0006 JMPF R7 #003D + 0x1C1C0D04, // 0007 EQ R7 R6 K4 + 0x781E0011, // 0008 JMPF R7 #001B + 0x881C0105, // 0009 GETMBR R7 R0 K5 + 0x4C200000, // 000A LDNIL R8 + 0x201C0E08, // 000B NE R7 R7 R8 + 0x781E0007, // 000C JMPF R7 #0015 + 0x8C1C0706, // 000D GETMET R7 R3 K6 + 0x88240907, // 000E GETMBR R9 R4 K7 + 0x60280009, // 000F GETGBL R10 G9 + 0x882C0105, // 0010 GETMBR R11 R0 K5 + 0x7C280200, // 0011 CALL R10 1 + 0x7C1C0600, // 0012 CALL R7 3 + 0x80040E00, // 0013 RET 1 R7 + 0x70020004, // 0014 JMP #001A + 0x8C1C0706, // 0015 GETMET R7 R3 K6 + 0x88240908, // 0016 GETMBR R9 R4 K8 + 0x4C280000, // 0017 LDNIL R10 + 0x7C1C0600, // 0018 CALL R7 3 + 0x80040E00, // 0019 RET 1 R7 + 0x70020020, // 001A JMP #003C + 0x1C1C0D09, // 001B EQ R7 R6 K9 + 0x781E0005, // 001C JMPF R7 #0023 + 0x8C1C0706, // 001D GETMET R7 R3 K6 + 0x88240907, // 001E GETMBR R9 R4 K7 + 0x542A01F3, // 001F LDINT R10 500 + 0x7C1C0600, // 0020 CALL R7 3 + 0x80040E00, // 0021 RET 1 R7 + 0x70020018, // 0022 JMP #003C + 0x1C1C0D0A, // 0023 EQ R7 R6 K10 + 0x781E0005, // 0024 JMPF R7 #002B + 0x8C1C0706, // 0025 GETMET R7 R3 K6 + 0x88240907, // 0026 GETMBR R9 R4 K7 + 0x542A05DB, // 0027 LDINT R10 1500 + 0x7C1C0600, // 0028 CALL R7 3 + 0x80040E00, // 0029 RET 1 R7 + 0x70020010, // 002A JMP #003C + 0x541EFFFB, // 002B LDINT R7 65532 + 0x1C1C0C07, // 002C EQ R7 R6 R7 + 0x781E0005, // 002D JMPF R7 #0034 + 0x8C1C0706, // 002E GETMET R7 R3 K6 + 0x8824090B, // 002F GETMBR R9 R4 K11 + 0x58280004, // 0030 LDCONST R10 K4 + 0x7C1C0600, // 0031 CALL R7 3 + 0x80040E00, // 0032 RET 1 R7 + 0x70020007, // 0033 JMP #003C + 0x541EFFFC, // 0034 LDINT R7 65533 + 0x1C1C0C07, // 0035 EQ R7 R6 R7 + 0x781E0004, // 0036 JMPF R7 #003C + 0x8C1C0706, // 0037 GETMET R7 R3 K6 + 0x8824090B, // 0038 GETMBR R9 R4 K11 + 0x5828000C, // 0039 LDCONST R10 K12 + 0x7C1C0600, // 003A CALL R7 3 + 0x80040E00, // 003B RET 1 R7 + 0x70020008, // 003C JMP #0046 + 0x601C0003, // 003D GETGBL R7 G3 + 0x5C200000, // 003E MOVE R8 R0 + 0x7C1C0200, // 003F CALL R7 1 + 0x8C1C0F0D, // 0040 GETMET R7 R7 K13 + 0x5C240200, // 0041 MOVE R9 R1 + 0x5C280400, // 0042 MOVE R10 R2 + 0x5C2C0600, // 0043 MOVE R11 R3 + 0x7C1C0800, // 0044 CALL R7 4 + 0x80040E00, // 0045 RET 1 R7 + 0x80000000, // 0046 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pre_value +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Flow_pre_value, /* name */ + be_nested_proto( + 4, /* 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[ 9]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x20080202, // 0001 NE R2 R1 R2 + 0x780A0003, // 0002 JMPF R2 #0007 + 0x60080009, // 0003 GETGBL R2 G9 + 0x5C0C0200, // 0004 MOVE R3 R1 + 0x7C080200, // 0005 CALL R2 1 + 0x70020000, // 0006 JMP #0008 + 0x4C080000, // 0007 LDNIL R2 + 0x80040400, // 0008 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Matter_Plugin_Sensor_Flow +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Sensor; +be_local_class(Matter_Plugin_Sensor_Flow, + 0, + &be_class_Matter_Plugin_Sensor, + be_nested_map(9, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Flow) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(flow) }, + { be_const_key_weak(TYPES, 8), 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(774, -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(Flow), + })) ) } )) }, + { be_const_key_weak(value_changed, 7), be_const_closure(Matter_Plugin_Sensor_Flow_value_changed_closure) }, + { be_const_key_weak(JSON_NAME, -1), be_nested_str_weak(Flow) }, + { be_const_key_weak(read_attribute, -1), be_const_closure(Matter_Plugin_Sensor_Flow_read_attribute_closure) }, + { be_const_key_weak(CLUSTERS, -1), 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, { + be_const_list( * be_nested_list(8, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(4), + be_const_int(5), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(57, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(7, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(17), + be_const_int(3), + be_const_int(5), + be_const_int(10), + be_const_int(15), + be_const_int(17), + be_const_int(18), + })) ) } )) }, + { be_const_key_int(1028, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(5, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(3, 1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(4, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(4, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(3, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(29, 0), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(6, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + })) ) } )) }, + { be_const_key_weak(pre_value, -1), be_const_closure(Matter_Plugin_Sensor_Flow_pre_value_closure) }, + })), + be_str_weak(Matter_Plugin_Sensor_Flow) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Sensor_Flow_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Sensor_Flow); + be_setglobal(vm, "Matter_Plugin_Sensor_Flow"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h new file mode 100644 index 000000000..ae0bc7a2b --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h @@ -0,0 +1,314 @@ +/* Solidification of Matter_Plugin_4_Bridge_Sensor_Flow.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Bridge_Sensor_Flow; + +/******************************************************************** +** Solidified function: pre_value +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_pre_value, /* name */ + be_nested_proto( + 4, /* 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[ 9]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x20080202, // 0001 NE R2 R1 R2 + 0x780A0003, // 0002 JMPF R2 #0007 + 0x60080009, // 0003 GETGBL R2 G9 + 0x5C0C0200, // 0004 MOVE R3 R1 + 0x7C080200, // 0005 CALL R2 1 + 0x70020000, // 0006 JMP #0008 + 0x4C080000, // 0007 LDNIL R2 + 0x80040400, // 0008 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: value_changed +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_value_changed, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* 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(attribute_updated), + /* K1 */ be_const_int(0), + }), + be_str_weak(value_changed), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0403, // 0001 LDINT R3 1028 + 0x58100001, // 0002 LDCONST R4 K1 + 0x7C040600, // 0003 CALL R1 3 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read_attribute +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_read_attribute, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[14]) { /* constants */ + /* K0 */ be_nested_str_weak(matter), + /* K1 */ be_nested_str_weak(TLV), + /* K2 */ be_nested_str_weak(cluster), + /* K3 */ be_nested_str_weak(attribute), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(shadow_value), + /* K6 */ be_nested_str_weak(set), + /* K7 */ be_nested_str_weak(I2), + /* K8 */ be_nested_str_weak(NULL), + /* K9 */ be_const_int(1), + /* K10 */ be_const_int(2), + /* K11 */ be_nested_str_weak(U4), + /* K12 */ be_const_int(3), + /* K13 */ be_nested_str_weak(read_attribute), + }), + be_str_weak(read_attribute), + &be_const_str_solidified, + ( &(const binstruction[71]) { /* code */ + 0xB8120000, // 0000 GETNGBL R4 K0 + 0x88100901, // 0001 GETMBR R4 R4 K1 + 0x88140502, // 0002 GETMBR R5 R2 K2 + 0x88180503, // 0003 GETMBR R6 R2 K3 + 0x541E0403, // 0004 LDINT R7 1028 + 0x1C1C0A07, // 0005 EQ R7 R5 R7 + 0x781E0035, // 0006 JMPF R7 #003D + 0x1C1C0D04, // 0007 EQ R7 R6 K4 + 0x781E0011, // 0008 JMPF R7 #001B + 0x881C0105, // 0009 GETMBR R7 R0 K5 + 0x4C200000, // 000A LDNIL R8 + 0x201C0E08, // 000B NE R7 R7 R8 + 0x781E0007, // 000C JMPF R7 #0015 + 0x8C1C0706, // 000D GETMET R7 R3 K6 + 0x88240907, // 000E GETMBR R9 R4 K7 + 0x60280009, // 000F GETGBL R10 G9 + 0x882C0105, // 0010 GETMBR R11 R0 K5 + 0x7C280200, // 0011 CALL R10 1 + 0x7C1C0600, // 0012 CALL R7 3 + 0x80040E00, // 0013 RET 1 R7 + 0x70020004, // 0014 JMP #001A + 0x8C1C0706, // 0015 GETMET R7 R3 K6 + 0x88240908, // 0016 GETMBR R9 R4 K8 + 0x4C280000, // 0017 LDNIL R10 + 0x7C1C0600, // 0018 CALL R7 3 + 0x80040E00, // 0019 RET 1 R7 + 0x70020020, // 001A JMP #003C + 0x1C1C0D09, // 001B EQ R7 R6 K9 + 0x781E0005, // 001C JMPF R7 #0023 + 0x8C1C0706, // 001D GETMET R7 R3 K6 + 0x88240907, // 001E GETMBR R9 R4 K7 + 0x58280004, // 001F LDCONST R10 K4 + 0x7C1C0600, // 0020 CALL R7 3 + 0x80040E00, // 0021 RET 1 R7 + 0x70020018, // 0022 JMP #003C + 0x1C1C0D0A, // 0023 EQ R7 R6 K10 + 0x781E0005, // 0024 JMPF R7 #002B + 0x8C1C0706, // 0025 GETMET R7 R3 K6 + 0x88240907, // 0026 GETMBR R9 R4 K7 + 0x542AFFFD, // 0027 LDINT R10 65534 + 0x7C1C0600, // 0028 CALL R7 3 + 0x80040E00, // 0029 RET 1 R7 + 0x70020010, // 002A JMP #003C + 0x541EFFFB, // 002B LDINT R7 65532 + 0x1C1C0C07, // 002C EQ R7 R6 R7 + 0x781E0005, // 002D JMPF R7 #0034 + 0x8C1C0706, // 002E GETMET R7 R3 K6 + 0x8824090B, // 002F GETMBR R9 R4 K11 + 0x58280004, // 0030 LDCONST R10 K4 + 0x7C1C0600, // 0031 CALL R7 3 + 0x80040E00, // 0032 RET 1 R7 + 0x70020007, // 0033 JMP #003C + 0x541EFFFC, // 0034 LDINT R7 65533 + 0x1C1C0C07, // 0035 EQ R7 R6 R7 + 0x781E0004, // 0036 JMPF R7 #003C + 0x8C1C0706, // 0037 GETMET R7 R3 K6 + 0x8824090B, // 0038 GETMBR R9 R4 K11 + 0x5828000C, // 0039 LDCONST R10 K12 + 0x7C1C0600, // 003A CALL R7 3 + 0x80040E00, // 003B RET 1 R7 + 0x70020008, // 003C JMP #0046 + 0x601C0003, // 003D GETGBL R7 G3 + 0x5C200000, // 003E MOVE R8 R0 + 0x7C1C0200, // 003F CALL R7 1 + 0x8C1C0F0D, // 0040 GETMET R7 R7 K13 + 0x5C240200, // 0041 MOVE R9 R1 + 0x5C280400, // 0042 MOVE R10 R2 + 0x5C2C0600, // 0043 MOVE R11 R3 + 0x7C1C0800, // 0044 CALL R7 4 + 0x80040E00, // 0045 RET 1 R7 + 0x80000000, // 0046 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: web_values +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_web_values, /* name */ + be_nested_proto( + 8, /* nstack */ + 1, /* 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(webserver), + /* K1 */ be_nested_str_weak(web_values_prefix), + /* K2 */ be_nested_str_weak(content_send), + /* K3 */ be_nested_str_weak(_X26_X23x26C5_X3B_X20_X25i_X20m3_X2Fh), + /* K4 */ be_nested_str_weak(shadow_value), + }), + be_str_weak(web_values), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080101, // 0001 GETMET R2 R0 K1 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080302, // 0003 GETMET R2 R1 K2 + 0x60100018, // 0004 GETGBL R4 G24 + 0x58140003, // 0005 LDCONST R5 K3 + 0x60180009, // 0006 GETGBL R6 G9 + 0x881C0104, // 0007 GETMBR R7 R0 K4 + 0x7C180200, // 0008 CALL R6 1 + 0x7C100400, // 0009 CALL R4 2 + 0x7C080400, // 000A CALL R2 2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Matter_Plugin_Bridge_Sensor_Flow +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Bridge_Sensor; +be_local_class(Matter_Plugin_Bridge_Sensor_Flow, + 0, + &be_class_Matter_Plugin_Bridge_Sensor, + be_nested_map(8, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(pre_value, 1), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_pre_value_closure) }, + { be_const_key_weak(web_values, -1), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_web_values_closure) }, + { be_const_key_weak(TYPES, 3), 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(774, -1), be_const_int(2) }, + })) ) } )) }, + { be_const_key_weak(read_attribute, 7), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_read_attribute_closure) }, + { be_const_key_weak(value_changed, 6), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_value_changed_closure) }, + { be_const_key_weak(DISPLAY_NAME, 4), be_nested_str_weak(Flow) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(http_flow) }, + { be_const_key_weak(CLUSTERS, -1), 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, { + be_const_list( * be_nested_list(8, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(4), + be_const_int(5), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(57, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(7, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(17), + be_const_int(3), + be_const_int(5), + be_const_int(10), + be_const_int(15), + be_const_int(17), + be_const_int(18), + })) ) } )) }, + { be_const_key_int(1028, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(5, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(3, 1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(4, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(4, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(3, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(29, 0), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(6, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + })) ) } )) }, + })), + be_str_weak(Matter_Plugin_Bridge_Sensor_Flow) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Bridge_Sensor_Flow_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Bridge_Sensor_Flow); + be_setglobal(vm, "Matter_Plugin_Bridge_Sensor_Flow"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h new file mode 100644 index 000000000..d557dabb9 --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h @@ -0,0 +1,34 @@ +/* Solidification of Matter_Plugin_9_Virt_Sensor_Flow.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Virt_Sensor_Flow; + +/******************************************************************** +** Solidified class: Matter_Plugin_Virt_Sensor_Flow +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Sensor_Flow; +be_local_class(Matter_Plugin_Virt_Sensor_Flow, + 0, + &be_class_Matter_Plugin_Sensor_Flow, + be_nested_map(5, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(VIRTUAL, 3), be_const_bool(1) }, + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(v_X2EFlow) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(v_flow) }, + { be_const_key_weak(ARG_HINT, -1), be_nested_str_weak(_Not_X20used_) }, + { be_const_key_weak(ARG, 2), be_nested_str_weak() }, + })), + be_str_weak(Matter_Plugin_Virt_Sensor_Flow) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Virt_Sensor_Flow_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Virt_Sensor_Flow); + be_setglobal(vm, "Matter_Plugin_Virt_Sensor_Flow"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h index ab7c2e09e..58097a058 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h @@ -3360,7 +3360,7 @@ be_local_class(Matter_UI, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key_weak(equal_map, -1), be_const_static_closure(Matter_UI_equal_map_closure) }, { be_const_key_weak(page_part_mgr_adv, -1), be_const_closure(Matter_UI_page_part_mgr_adv_closure) }, - { be_const_key_weak(_CLASSES_TYPES2, -1), be_nested_str_weak(_X7Chttp_relay_X7Chttp_light0_X7Chttp_light1_X7Chttp_light2_X7Chttp_light3_X7Chttp_temperature_X7Chttp_pressure_X7Chttp_illuminance_X7Chttp_humidity_X7Chttp_occupancy_X7Chttp_contact) }, + { be_const_key_weak(_CLASSES_TYPES2, -1), be_nested_str_weak(_X7Chttp_relay_X7Chttp_light0_X7Chttp_light1_X7Chttp_light2_X7Chttp_light3_X7Chttp_temperature_X7Chttp_pressure_X7Chttp_illuminance_X7Chttp_humidity_X7Chttp_occupancy_X7Chttp_contact_X7Chttp_flow) }, { be_const_key_weak(page_part_mgr, 25), be_const_closure(Matter_UI_page_part_mgr_closure) }, { be_const_key_weak(show_plugins_hints_js, -1), be_const_closure(Matter_UI_show_plugins_hints_js_closure) }, { be_const_key_weak(show_enable, -1), be_const_closure(Matter_UI_show_enable_closure) }, @@ -3372,7 +3372,7 @@ be_local_class(Matter_UI, { be_const_key_weak(show_commissioning_info, -1), be_const_closure(Matter_UI_show_commissioning_info_closure) }, { be_const_key_weak(page_part_ctl, 18), be_const_closure(Matter_UI_page_part_ctl_closure) }, { be_const_key_weak(show_fabric_info, -1), be_const_closure(Matter_UI_show_fabric_info_closure) }, - { be_const_key_weak(_CLASSES_TYPES, 4), be_nested_str_weak(_X7Crelay_X7Clight0_X7Clight1_X7Clight2_X7Clight3_X7Cshutter_X7Cshutter_X2Btilt_X7Ctemperature_X7Cpressure_X7Cilluminance_X7Chumidity_X7Coccupancy_X7Conoff_X7Ccontact_X7C_X2Dvirtual_X7Cv_relay_X7Cv_light0_X7Cv_light1_X7Cv_light2_X7Cv_light3_X7Cv_temp_X7Cv_pressure_X7Cv_illuminance_X7Cv_humidity_X7Cv_occupancy_X7Cv_contact) }, + { be_const_key_weak(_CLASSES_TYPES, 4), be_nested_str_weak(_X7Crelay_X7Clight0_X7Clight1_X7Clight2_X7Clight3_X7Cshutter_X7Cshutter_X2Btilt_X7Ctemperature_X7Cpressure_X7Cilluminance_X7Chumidity_X7Coccupancy_X7Conoff_X7Ccontact_X7Cflow_X7C_X2Dvirtual_X7Cv_relay_X7Cv_light0_X7Cv_light1_X7Cv_light2_X7Cv_light3_X7Cv_temp_X7Cv_pressure_X7Cv_illuminance_X7Cv_humidity_X7Cv_occupancy_X7Cv_contact_X7Cv_flow) }, { be_const_key_weak(web_get_arg, -1), be_const_closure(Matter_UI_web_get_arg_closure) }, { be_const_key_weak(plugin_option, 5), be_const_closure(Matter_UI_plugin_option_closure) }, { be_const_key_weak(web_add_config_button, -1), be_const_closure(Matter_UI_web_add_config_button_closure) },