Create Matter_Plugin_9_Virt_Sensor_Occupancy.h (#19786)

* Create Matter_Plugin_9_Virt_Sensor_Occupancy.h

* Create Matter_Plugin_9_Virt_Sensor_Occupancy.be

Implements the behavior for a Virtual Occupancy Sensor

* Update be_matter_module.c

Enable Virt_Sensor_Occupancy

* Create solidified_Matter_Plugin_9_Virt_Sensor_Occupancy.h

* Update Matter_UI.be

Add missing v_occupancy and v_onoff

* Update solidified_Matter_UI.h

* Update be_matter_module.c

* Update be_matter_module.c

* Update Matter_Plugin_9_Virt_Sensor_Occupancy.be

* Delete lib/libesp32/berry_matter/src/solidify/Matter_Plugin_9_Virt_Sensor_Occupancy.h

Remove undeeded file

* Update solidified_Matter_Plugin_9_Virt_Sensor_Occupancy.h

Fix case

* Update solidified_Matter_UI.h

Fix case

* Update be_matter_module.c

Update

* Update Matter_UI.be

remove v_onoff

* Update solidified_Matter_UI.h

update

---------

Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com>
This commit is contained in:
Ludovic BOUÉ 2023-10-19 22:55:29 +02:00 committed by GitHub
parent 88a3d6cb7e
commit 6844bb606d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 2 deletions

View File

@ -237,6 +237,7 @@ extern const bclass be_class_Matter_TLV; // need to declare it upfront because
#include "solidify/solidified_Matter_Plugin_3_Sensor_OnOff.h"
#include "solidify/solidified_Matter_Plugin_3_Sensor_Contact.h"
#include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Contact.h"
#include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Occupancy.h"
#include "solidify/solidified_Matter_Plugin_2_Bridge_HTTP.h"
#include "solidify/solidified_Matter_Plugin_4_Bridge_OnOff.h"
#include "solidify/solidified_Matter_Plugin_3_Bridge_Light0.h"
@ -457,6 +458,7 @@ module matter (scope: global, strings: weak) {
Plugin_Sensor_Occupancy, class(be_class_Matter_Plugin_Sensor_Occupancy) // Occupancy Sensor
Plugin_Sensor_OnOff, class(be_class_Matter_Plugin_Sensor_OnOff) // Simple OnOff Sensor
Plugin_Sensor_Contact, class(be_class_Matter_Plugin_Sensor_Contact) // Contact Sensor
Plugin_Virt_Sensor_Occupancy, class(be_class_Matter_Plugin_Virt_Sensor_Occupancy) // Virtual Occupancy Sensor
Plugin_Virt_Sensor_Contact, class(be_class_Matter_Plugin_Virt_Sensor_Contact) // Virtual Contact Sensor
Plugin_Bridge_HTTP, class(be_class_Matter_Plugin_Bridge_HTTP) // HTTP bridge superclass
Plugin_Bridge_OnOff, class(be_class_Matter_Plugin_Bridge_OnOff) // HTTP Relay/Light behavior (OnOff)

View File

@ -0,0 +1,34 @@
#
# Matter_Plugin_9_Virt_Sensor_Occupancy.be - implements the behavior for a Virtual Occupancy 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 <http://www.gnu.org/licenses/>.
#
import matter
# Matter plug-in for core behavior
#@ solidify:Matter_Plugin_Virt_Sensor_Occupancy,weak
class Matter_Plugin_Virt_Sensor_Occupancy : Matter_Plugin_Sensor_Occupancy
static var TYPE = "v_occupancy" # name of the plug-in in json
static var DISPLAY_NAME = "v.Occupancy" # 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_Occupancy = Matter_Plugin_Virt_Sensor_Occupancy

View File

@ -35,7 +35,7 @@ class Matter_UI
static var _CLASSES_TYPES = "|relay|light0|light1|light2|light3|shutter|shutter+tilt"
"|temperature|pressure|illuminance|humidity|occupancy|onoff|contact"
"|-virtual|v_relay|v_light0|v_light1|v_light2|v_light3"
"|v_temp|v_pressure|v_illuminance|v_humidity|v_contact"
"|v_temp|v_pressure|v_illuminance|v_humidity|v_occupancy|v_contact"
# 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"

View File

@ -0,0 +1,34 @@
/* Solidification of Matter_Plugin_9_Virt_Sensor_Occupancy.h */
/********************************************************************\
* Generated code, don't edit *
\********************************************************************/
#include "be_constobj.h"
extern const bclass be_class_Matter_Plugin_Virt_Sensor_Occupancy;
/********************************************************************
** Solidified class: Matter_Plugin_Virt_Sensor_Occupancy
********************************************************************/
extern const bclass be_class_Matter_Plugin_Sensor_Occupancy;
be_local_class(Matter_Plugin_Virt_Sensor_Occupancy,
0,
&be_class_Matter_Plugin_Sensor_Occupancy,
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_X2EOccupancy) },
{ be_const_key_weak(TYPE, -1), be_nested_str_weak(v_occupancy) },
{ 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_Occupancy)
);
/*******************************************************************/
void be_load_Matter_Plugin_Virt_Sensor_Occupancy_class(bvm *vm) {
be_pushntvclass(vm, &be_class_Matter_Plugin_Virt_Sensor_Occupancy);
be_setglobal(vm, "Matter_Plugin_Virt_Sensor_Occupancy");
be_pop(vm, 1);
}
/********************************************************************/
/* End of solidification */

View File

@ -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_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_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(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) },