what the zigbee device reports only gets shown when the device sends the data. This data is then handled by the converter to interpret. Some devices may always send the linkquality on a regular basis, some not. One helpful tool to check the linkquality is to use the network map. There you see the routes and linkqualities.
As the the log suggests, there was a timeout. Either there was no repsonse by the device and thus the message could not be delivered or the sent command was not recognised. As this is more a zigbee2mqtt than OH issue, I would search on the project’s github page.
What does your thing look like? So far, I’m only using attributes (works fine) but have added json. But I’m not familar with json and information on color-transformation are a bit tricky to find.
In the past I formatted within the thing, but now I split it and use transformations. With this I only need the colorpicker on the sitemap as it has the toggle already built in. Here is an example
(function (x) {
if (x=="ON" || x=="INCREASE") {
return '{"state":"ON","transition":0.3}'
} else if (x=="OFF" || x=="DECREASE") {
return '{"state":"OFF","transition":0.3}'
} else {
var tex = x.split(',');
s = parseInt(tex[1]);
v = parseInt(tex[2]);
h = parseInt(tex[0]);
h=(!h ? 0 : h/360.0);
s=(!s ? 0 : s/100.0);
v=(!v ? 0 : v/100.0);
i = Math.floor(h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return '{"brightness":'+ Math.round(v * 255)+',"color":{"rgb":"'+ Math.round(r * 255)+','+ Math.round(g * 255)+','+Math.round(b * 255)+'"},"transition":0.7}'
}
})(input)
It would be very nice if every one that has a working configuration. Submit it to the zigbee2mqtt GitHub documentation. It is very easy to do. You need to make a Git Hub account.
So, i shared my configuration for an MCCGQ01LM Xiaomi MiJia door & window contact sensor (contact) as you suggested on the zigbee2mqtt device page. Lets see if and when it will be merged.
Update: It is already merged. So if someone can check if it is appropriated described.
I have noticed that it allows to indicate the expiration time
Xiaomi Aqara human body movement and illuminance sensor RTCGQ11LM thing:
Thing topic TEMD "TEMD" @ "TE"
{
Channels:
Type switch : occupancy "occupancy" [ stateTopic = "zigbee2mqtt/TEMD/occupancy", on="true", off="false" ]
Type number : illuminance "illuminance" [ stateTopic = "zigbee2mqtt/TEMD/illuminance" ]
Type number : voltage "voltage" [ stateTopic = "zigbee2mqtt/TEMD/voltage" ]
Type number : battery "battery" [ stateTopic = "zigbee2mqtt/TEMD/battery" ]
Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/TEMD/linkquality" ]
}
``` Type switch : occupancy "occupancy" [ stateTopic = "zigbee2mqtt/TEMD/occupancy", on="true", off="false" , expire="1m" ]
I have noticed that it allows to indicate the expiration time
Nice try, but it didn’t work, at least not for me. I changed my thing file, as you suggested to set the expiration time to 1 Minute (which by the way is the most shorted value you can use) and it still expires after 90 seconds which is the default. I mean it is possible, to change the expiration time as described on the manual page, but obviously not like you have described here. It is still possible, that I did something wrong. But I added your , expire="1m" to my working configuration and than commented out the thing in my thing file, saved it and after that removed comment and saved it again.
By the way, this is the workaround instead of restarting OpenHAB when making changes to an exisiting thing by first deleting (commenting it out) the thing and than save the thing file and removing the comment and saving it again, which obviuously recreates a thing instead of just restarting it.
I do not think, this will work as expected. Just if you expire before the “occupancy = false” message is sent. If you set it to more than the usual 90 seconds, the standard message will switch the switch off before it expires.
If you want to change the expiration time, you have to to send this as a commandTopic. It will persisted. I remember this feature from the Xiaomi Binding…
Not exactly sure about the command in detail with Mqtt , but definitely not like the code above.
occupancy_timeout : Timeout (in seconds) after the occupancy: false message is sent. If not set, the timeout is 90 seconds. When set to 0 no occupancy: false is send.
IMPORTANT : occupancy_timeout should not be set to lower than 60 seconds. The reason is this: after detecting a motion the sensor ignores any movements for exactly 60 seconds. In case there are movements after this, a new message ( occupancy: true ) will be sent and the sensor will go for one more minute sleep, and so on. This is expected behaviour (see #270). To work around this, ahardware modification is needed.
Inspired by @Josep_Xavier_Sellart i read a little deeper into the zigbee2mqtt documentation to figure out how to set the expiration time of a zigbee RTCGQ01LM occupancy sensor. So as @chrode mentioned there is a parameter to set the occupancy timeout of the RTCGQ01LM sensor
But this can’t be done on an OpenHAB level, this has to be done on zigbee2mqtt level in the configuration files.
There are two possibilities to set a new occupancy_timeout value for an occupancy sensor:
For all occupancy sensors
Add to your configuration.yaml of your zigbee2mqtt installation the following two lines:
#set the occupancy timeout for all devices to 120 seconds
device_options:
occupancy_timeout: 120
For a specific occupancy sensor
In this case you have to add one line to the specific configuration of the device in the devices: section of the configuration.yaml
devices:
'0x0000000000000001':
friendly_name: SomeOtherZigbeeDevice1
#set the occupancy timeout for a specific device to 120 seconds
'0x0000000000000002':
friendly_name: MotionSensorKU
occupancy_timeout: 120
'0x0000000000000003':
friendly_name: SomeOtherZigbeeDevice2
Don’t forget to restart zigbee2mqtt on your linux machine by sudo systemctl restart zigbee2mqtt