mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-25 07:17:16 +00:00
Matter fix local Occupancy sensor (#18857)
* Matter fix local Occupancy sensor * Fix also OnOff
This commit is contained in:
parent
c88bff5a46
commit
badf064ab4
@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Interaction of ``SetOption92``, ``VirtualCT``, and ``RGBWWTable`` (#18768)
|
- Interaction of ``SetOption92``, ``VirtualCT``, and ``RGBWWTable`` (#18768)
|
||||||
- Fixed HASPmota event when value is non-integer (fixes #18229)
|
- Fixed HASPmota event when value is non-integer (fixes #18229)
|
||||||
|
- Matter fix local Occupancy sensor
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -54,20 +54,17 @@ class Matter_Plugin_Sensor_Occupancy : Matter_Plugin_Device
|
|||||||
#
|
#
|
||||||
def update_shadow()
|
def update_shadow()
|
||||||
super(self).update_shadow()
|
super(self).update_shadow()
|
||||||
|
var switch_str = "Switch" + str(self.tasmota_switch_index)
|
||||||
|
|
||||||
import json
|
var j = tasmota.cmd("Status 8", true)
|
||||||
var ret = tasmota.cmd("Status 8", true)
|
if j != nil j = j.find("StatusSNS") end
|
||||||
if ret != nil
|
if j != nil && j.contains(switch_str)
|
||||||
var j = json.load(ret)
|
var state = (j.find(switch_str) == "ON")
|
||||||
if j != nil
|
|
||||||
var state = false
|
|
||||||
state = (j.find("Switch" + str(self.tasmota_switch_index)) == "ON")
|
|
||||||
|
|
||||||
if self.shadow_occupancy != nil && self.shadow_occupancy != bool(state)
|
if (self.shadow_occupancy != state)
|
||||||
self.attribute_updated(0x0406, 0x0000)
|
self.attribute_updated(0x0406, 0x0000)
|
||||||
end
|
|
||||||
self.shadow_occupancy = state
|
|
||||||
end
|
end
|
||||||
|
self.shadow_occupancy = state
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,20 +52,17 @@ class Matter_Plugin_Sensor_OnOff : Matter_Plugin_Device
|
|||||||
#
|
#
|
||||||
def update_shadow()
|
def update_shadow()
|
||||||
super(self).update_shadow()
|
super(self).update_shadow()
|
||||||
|
var switch_str = "Switch" + str(self.tasmota_switch_index)
|
||||||
|
|
||||||
import json
|
var j = tasmota.cmd("Status 8", true)
|
||||||
var ret = tasmota.cmd("Status 8", true)
|
if j != nil j = j.find("StatusSNS") end
|
||||||
if ret != nil
|
if j != nil && j.contains(switch_str)
|
||||||
var j = json.load(ret)
|
var state = (j.find(switch_str) == "ON")
|
||||||
if j != nil
|
|
||||||
var state = false
|
|
||||||
state = (j.find("Switch" + str(self.tasmota_switch_index)) == "ON")
|
|
||||||
|
|
||||||
if self.shadow_onoff != nil && self.shadow_onoff != bool(state)
|
if (self.shadow_onoff != state)
|
||||||
self.attribute_updated(0x0406, 0x0000)
|
self.attribute_updated(0x0006, 0x0000)
|
||||||
end
|
|
||||||
self.shadow_onoff = state
|
|
||||||
end
|
end
|
||||||
|
self.shadow_onoff = state
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_read_attribute, /* name */
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
be_local_closure(Matter_Plugin_Sensor_Occupancy_update_shadow, /* name */
|
be_local_closure(Matter_Plugin_Sensor_Occupancy_update_shadow, /* name */
|
||||||
be_nested_proto(
|
be_nested_proto(
|
||||||
9, /* nstack */
|
8, /* nstack */
|
||||||
1, /* argc */
|
1, /* argc */
|
||||||
2, /* varg */
|
2, /* varg */
|
||||||
0, /* has upvals */
|
0, /* has upvals */
|
||||||
@ -197,14 +197,14 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_update_shadow, /* name */
|
|||||||
1, /* has constants */
|
1, /* has constants */
|
||||||
( &(const bvalue[13]) { /* constants */
|
( &(const bvalue[13]) { /* constants */
|
||||||
/* K0 */ be_nested_str_weak(update_shadow),
|
/* K0 */ be_nested_str_weak(update_shadow),
|
||||||
/* K1 */ be_nested_str_weak(json),
|
/* K1 */ be_nested_str_weak(Switch),
|
||||||
/* K2 */ be_nested_str_weak(tasmota),
|
/* K2 */ be_nested_str_weak(tasmota_switch_index),
|
||||||
/* K3 */ be_nested_str_weak(cmd),
|
/* K3 */ be_nested_str_weak(tasmota),
|
||||||
/* K4 */ be_nested_str_weak(Status_X208),
|
/* K4 */ be_nested_str_weak(cmd),
|
||||||
/* K5 */ be_nested_str_weak(load),
|
/* K5 */ be_nested_str_weak(Status_X208),
|
||||||
/* K6 */ be_nested_str_weak(find),
|
/* K6 */ be_nested_str_weak(find),
|
||||||
/* K7 */ be_nested_str_weak(Switch),
|
/* K7 */ be_nested_str_weak(StatusSNS),
|
||||||
/* K8 */ be_nested_str_weak(tasmota_switch_index),
|
/* K8 */ be_nested_str_weak(contains),
|
||||||
/* K9 */ be_nested_str_weak(ON),
|
/* K9 */ be_nested_str_weak(ON),
|
||||||
/* K10 */ be_nested_str_weak(shadow_occupancy),
|
/* K10 */ be_nested_str_weak(shadow_occupancy),
|
||||||
/* K11 */ be_nested_str_weak(attribute_updated),
|
/* K11 */ be_nested_str_weak(attribute_updated),
|
||||||
@ -212,52 +212,48 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_update_shadow, /* name */
|
|||||||
}),
|
}),
|
||||||
be_str_weak(update_shadow),
|
be_str_weak(update_shadow),
|
||||||
&be_const_str_solidified,
|
&be_const_str_solidified,
|
||||||
( &(const binstruction[45]) { /* code */
|
( &(const binstruction[41]) { /* code */
|
||||||
0x60040003, // 0000 GETGBL R1 G3
|
0x60040003, // 0000 GETGBL R1 G3
|
||||||
0x5C080000, // 0001 MOVE R2 R0
|
0x5C080000, // 0001 MOVE R2 R0
|
||||||
0x7C040200, // 0002 CALL R1 1
|
0x7C040200, // 0002 CALL R1 1
|
||||||
0x8C040300, // 0003 GETMET R1 R1 K0
|
0x8C040300, // 0003 GETMET R1 R1 K0
|
||||||
0x7C040200, // 0004 CALL R1 1
|
0x7C040200, // 0004 CALL R1 1
|
||||||
0xA4060200, // 0005 IMPORT R1 K1
|
0x60040008, // 0005 GETGBL R1 G8
|
||||||
0xB80A0400, // 0006 GETNGBL R2 K2
|
0x88080102, // 0006 GETMBR R2 R0 K2
|
||||||
0x8C080503, // 0007 GETMET R2 R2 K3
|
0x7C040200, // 0007 CALL R1 1
|
||||||
0x58100004, // 0008 LDCONST R4 K4
|
0x00060201, // 0008 ADD R1 K1 R1
|
||||||
0x50140200, // 0009 LDBOOL R5 1 0
|
0xB80A0600, // 0009 GETNGBL R2 K3
|
||||||
0x7C080600, // 000A CALL R2 3
|
0x8C080504, // 000A GETMET R2 R2 K4
|
||||||
0x4C0C0000, // 000B LDNIL R3
|
0x58100005, // 000B LDCONST R4 K5
|
||||||
0x200C0403, // 000C NE R3 R2 R3
|
0x50140200, // 000C LDBOOL R5 1 0
|
||||||
0x780E001D, // 000D JMPF R3 #002C
|
0x7C080600, // 000D CALL R2 3
|
||||||
0x8C0C0305, // 000E GETMET R3 R1 K5
|
0x4C0C0000, // 000E LDNIL R3
|
||||||
0x5C140400, // 000F MOVE R5 R2
|
0x200C0403, // 000F NE R3 R2 R3
|
||||||
0x7C0C0400, // 0010 CALL R3 2
|
0x780E0003, // 0010 JMPF R3 #0015
|
||||||
0x4C100000, // 0011 LDNIL R4
|
0x8C0C0506, // 0011 GETMET R3 R2 K6
|
||||||
0x20100604, // 0012 NE R4 R3 R4
|
0x58140007, // 0012 LDCONST R5 K7
|
||||||
0x78120017, // 0013 JMPF R4 #002C
|
0x7C0C0400, // 0013 CALL R3 2
|
||||||
0x50100000, // 0014 LDBOOL R4 0 0
|
0x5C080600, // 0014 MOVE R2 R3
|
||||||
0x8C140706, // 0015 GETMET R5 R3 K6
|
0x4C0C0000, // 0015 LDNIL R3
|
||||||
0x601C0008, // 0016 GETGBL R7 G8
|
0x200C0403, // 0016 NE R3 R2 R3
|
||||||
0x88200108, // 0017 GETMBR R8 R0 K8
|
0x780E000F, // 0017 JMPF R3 #0028
|
||||||
0x7C1C0200, // 0018 CALL R7 1
|
0x8C0C0508, // 0018 GETMET R3 R2 K8
|
||||||
0x001E0E07, // 0019 ADD R7 K7 R7
|
0x5C140200, // 0019 MOVE R5 R1
|
||||||
0x7C140400, // 001A CALL R5 2
|
0x7C0C0400, // 001A CALL R3 2
|
||||||
0x1C140B09, // 001B EQ R5 R5 K9
|
0x780E000B, // 001B JMPF R3 #0028
|
||||||
0x5C100A00, // 001C MOVE R4 R5
|
0x8C0C0506, // 001C GETMET R3 R2 K6
|
||||||
0x8814010A, // 001D GETMBR R5 R0 K10
|
0x5C140200, // 001D MOVE R5 R1
|
||||||
0x4C180000, // 001E LDNIL R6
|
0x7C0C0400, // 001E CALL R3 2
|
||||||
0x20140A06, // 001F NE R5 R5 R6
|
0x1C0C0709, // 001F EQ R3 R3 K9
|
||||||
0x78160009, // 0020 JMPF R5 #002B
|
0x8810010A, // 0020 GETMBR R4 R0 K10
|
||||||
0x8814010A, // 0021 GETMBR R5 R0 K10
|
0x20100803, // 0021 NE R4 R4 R3
|
||||||
0x60180017, // 0022 GETGBL R6 G23
|
0x78120003, // 0022 JMPF R4 #0027
|
||||||
0x5C1C0800, // 0023 MOVE R7 R4
|
0x8C10010B, // 0023 GETMET R4 R0 K11
|
||||||
0x7C180200, // 0024 CALL R6 1
|
0x541A0405, // 0024 LDINT R6 1030
|
||||||
0x20140A06, // 0025 NE R5 R5 R6
|
0x581C000C, // 0025 LDCONST R7 K12
|
||||||
0x78160003, // 0026 JMPF R5 #002B
|
0x7C100600, // 0026 CALL R4 3
|
||||||
0x8C14010B, // 0027 GETMET R5 R0 K11
|
0x90021403, // 0027 SETMBR R0 K10 R3
|
||||||
0x541E0405, // 0028 LDINT R7 1030
|
0x80000000, // 0028 RET 0
|
||||||
0x5820000C, // 0029 LDCONST R8 K12
|
|
||||||
0x7C140600, // 002A CALL R5 3
|
|
||||||
0x90021404, // 002B SETMBR R0 K10 R4
|
|
||||||
0x80000000, // 002C RET 0
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -160,7 +160,7 @@ be_local_closure(Matter_Plugin_Sensor_OnOff_read_attribute, /* name */
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
be_local_closure(Matter_Plugin_Sensor_OnOff_update_shadow, /* name */
|
be_local_closure(Matter_Plugin_Sensor_OnOff_update_shadow, /* name */
|
||||||
be_nested_proto(
|
be_nested_proto(
|
||||||
9, /* nstack */
|
8, /* nstack */
|
||||||
1, /* argc */
|
1, /* argc */
|
||||||
2, /* varg */
|
2, /* varg */
|
||||||
0, /* has upvals */
|
0, /* has upvals */
|
||||||
@ -170,14 +170,14 @@ be_local_closure(Matter_Plugin_Sensor_OnOff_update_shadow, /* name */
|
|||||||
1, /* has constants */
|
1, /* has constants */
|
||||||
( &(const bvalue[13]) { /* constants */
|
( &(const bvalue[13]) { /* constants */
|
||||||
/* K0 */ be_nested_str_weak(update_shadow),
|
/* K0 */ be_nested_str_weak(update_shadow),
|
||||||
/* K1 */ be_nested_str_weak(json),
|
/* K1 */ be_nested_str_weak(Switch),
|
||||||
/* K2 */ be_nested_str_weak(tasmota),
|
/* K2 */ be_nested_str_weak(tasmota_switch_index),
|
||||||
/* K3 */ be_nested_str_weak(cmd),
|
/* K3 */ be_nested_str_weak(tasmota),
|
||||||
/* K4 */ be_nested_str_weak(Status_X208),
|
/* K4 */ be_nested_str_weak(cmd),
|
||||||
/* K5 */ be_nested_str_weak(load),
|
/* K5 */ be_nested_str_weak(Status_X208),
|
||||||
/* K6 */ be_nested_str_weak(find),
|
/* K6 */ be_nested_str_weak(find),
|
||||||
/* K7 */ be_nested_str_weak(Switch),
|
/* K7 */ be_nested_str_weak(StatusSNS),
|
||||||
/* K8 */ be_nested_str_weak(tasmota_switch_index),
|
/* K8 */ be_nested_str_weak(contains),
|
||||||
/* K9 */ be_nested_str_weak(ON),
|
/* K9 */ be_nested_str_weak(ON),
|
||||||
/* K10 */ be_nested_str_weak(shadow_onoff),
|
/* K10 */ be_nested_str_weak(shadow_onoff),
|
||||||
/* K11 */ be_nested_str_weak(attribute_updated),
|
/* K11 */ be_nested_str_weak(attribute_updated),
|
||||||
@ -185,52 +185,48 @@ be_local_closure(Matter_Plugin_Sensor_OnOff_update_shadow, /* name */
|
|||||||
}),
|
}),
|
||||||
be_str_weak(update_shadow),
|
be_str_weak(update_shadow),
|
||||||
&be_const_str_solidified,
|
&be_const_str_solidified,
|
||||||
( &(const binstruction[45]) { /* code */
|
( &(const binstruction[41]) { /* code */
|
||||||
0x60040003, // 0000 GETGBL R1 G3
|
0x60040003, // 0000 GETGBL R1 G3
|
||||||
0x5C080000, // 0001 MOVE R2 R0
|
0x5C080000, // 0001 MOVE R2 R0
|
||||||
0x7C040200, // 0002 CALL R1 1
|
0x7C040200, // 0002 CALL R1 1
|
||||||
0x8C040300, // 0003 GETMET R1 R1 K0
|
0x8C040300, // 0003 GETMET R1 R1 K0
|
||||||
0x7C040200, // 0004 CALL R1 1
|
0x7C040200, // 0004 CALL R1 1
|
||||||
0xA4060200, // 0005 IMPORT R1 K1
|
0x60040008, // 0005 GETGBL R1 G8
|
||||||
0xB80A0400, // 0006 GETNGBL R2 K2
|
0x88080102, // 0006 GETMBR R2 R0 K2
|
||||||
0x8C080503, // 0007 GETMET R2 R2 K3
|
0x7C040200, // 0007 CALL R1 1
|
||||||
0x58100004, // 0008 LDCONST R4 K4
|
0x00060201, // 0008 ADD R1 K1 R1
|
||||||
0x50140200, // 0009 LDBOOL R5 1 0
|
0xB80A0600, // 0009 GETNGBL R2 K3
|
||||||
0x7C080600, // 000A CALL R2 3
|
0x8C080504, // 000A GETMET R2 R2 K4
|
||||||
0x4C0C0000, // 000B LDNIL R3
|
0x58100005, // 000B LDCONST R4 K5
|
||||||
0x200C0403, // 000C NE R3 R2 R3
|
0x50140200, // 000C LDBOOL R5 1 0
|
||||||
0x780E001D, // 000D JMPF R3 #002C
|
0x7C080600, // 000D CALL R2 3
|
||||||
0x8C0C0305, // 000E GETMET R3 R1 K5
|
0x4C0C0000, // 000E LDNIL R3
|
||||||
0x5C140400, // 000F MOVE R5 R2
|
0x200C0403, // 000F NE R3 R2 R3
|
||||||
0x7C0C0400, // 0010 CALL R3 2
|
0x780E0003, // 0010 JMPF R3 #0015
|
||||||
0x4C100000, // 0011 LDNIL R4
|
0x8C0C0506, // 0011 GETMET R3 R2 K6
|
||||||
0x20100604, // 0012 NE R4 R3 R4
|
0x58140007, // 0012 LDCONST R5 K7
|
||||||
0x78120017, // 0013 JMPF R4 #002C
|
0x7C0C0400, // 0013 CALL R3 2
|
||||||
0x50100000, // 0014 LDBOOL R4 0 0
|
0x5C080600, // 0014 MOVE R2 R3
|
||||||
0x8C140706, // 0015 GETMET R5 R3 K6
|
0x4C0C0000, // 0015 LDNIL R3
|
||||||
0x601C0008, // 0016 GETGBL R7 G8
|
0x200C0403, // 0016 NE R3 R2 R3
|
||||||
0x88200108, // 0017 GETMBR R8 R0 K8
|
0x780E000F, // 0017 JMPF R3 #0028
|
||||||
0x7C1C0200, // 0018 CALL R7 1
|
0x8C0C0508, // 0018 GETMET R3 R2 K8
|
||||||
0x001E0E07, // 0019 ADD R7 K7 R7
|
0x5C140200, // 0019 MOVE R5 R1
|
||||||
0x7C140400, // 001A CALL R5 2
|
0x7C0C0400, // 001A CALL R3 2
|
||||||
0x1C140B09, // 001B EQ R5 R5 K9
|
0x780E000B, // 001B JMPF R3 #0028
|
||||||
0x5C100A00, // 001C MOVE R4 R5
|
0x8C0C0506, // 001C GETMET R3 R2 K6
|
||||||
0x8814010A, // 001D GETMBR R5 R0 K10
|
0x5C140200, // 001D MOVE R5 R1
|
||||||
0x4C180000, // 001E LDNIL R6
|
0x7C0C0400, // 001E CALL R3 2
|
||||||
0x20140A06, // 001F NE R5 R5 R6
|
0x1C0C0709, // 001F EQ R3 R3 K9
|
||||||
0x78160009, // 0020 JMPF R5 #002B
|
0x8810010A, // 0020 GETMBR R4 R0 K10
|
||||||
0x8814010A, // 0021 GETMBR R5 R0 K10
|
0x20100803, // 0021 NE R4 R4 R3
|
||||||
0x60180017, // 0022 GETGBL R6 G23
|
0x78120003, // 0022 JMPF R4 #0027
|
||||||
0x5C1C0800, // 0023 MOVE R7 R4
|
0x8C10010B, // 0023 GETMET R4 R0 K11
|
||||||
0x7C180200, // 0024 CALL R6 1
|
0x541A0005, // 0024 LDINT R6 6
|
||||||
0x20140A06, // 0025 NE R5 R5 R6
|
0x581C000C, // 0025 LDCONST R7 K12
|
||||||
0x78160003, // 0026 JMPF R5 #002B
|
0x7C100600, // 0026 CALL R4 3
|
||||||
0x8C14010B, // 0027 GETMET R5 R0 K11
|
0x90021403, // 0027 SETMBR R0 K10 R3
|
||||||
0x541E0405, // 0028 LDINT R7 1030
|
0x80000000, // 0028 RET 0
|
||||||
0x5820000C, // 0029 LDCONST R8 K12
|
|
||||||
0x7C140600, // 002A CALL R5 3
|
|
||||||
0x90021404, // 002B SETMBR R0 K10 R4
|
|
||||||
0x80000000, // 002C RET 0
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user