Retrieve "lastmotion" from multiple Xiaomi motion sensors defined as a variable


#1

1) Give a description of the problem

Hi there,

I’ve created a simplified piston defining my problem. In this example I’m trying to turn on several lights if any of my Xiaomi motion sensors detect motion. If no new motion is detected within 5 minutes the lights should turn off.

The problem with the Xiaomi motion detectors is that during continuous motion, after detecting the initial “motion”, the sensors only updates “lastmotion”. So the “lastmotion” parameter is the value I need to retrieve to make sure motion is being detected.

When selecting multiple motion sensors in the if-statement, such as “Motion Sensor 1” and “Motion Sensor 6” it works great, I can select the “lastmotion” parameter to read. This is shown as the first option in the if-statement.

However, problems arise when defining the “AllMotion” variable at the top of the piston. When trying adding the “AllMotion” variable to the if-statement as a physical device, there is a super long list of parameters I can compare against, starting with “Acceleration, activities, alarm, altitude …”. The only option for motion is the actual “motion” parameter, whilst I need to select the “lastmotion” parameter, as explained above.

Is there any way to get retrieve the “lastmotion” parameter when defining multiple motion sensors as a single variable? Of course, in this simplified example I could just select the two motion sensors individually just as well. However, in my actual implementation there are multiple pistons that depend on a longer list of motion sensors. I’ll also use the defined “AllMotion” variable to detect illuminance of the motion sensors, so it’s already defined. Therefore, it would be quite nice to be able to read the ‘lastmotion’ parameter with the “AllMotion” variable.

2) What is the expected behavior?

The multiple motion sensors defined by the “AllMotion” variable should also give me the option the retrieve the “lastmotion” parameter, additionally to the “motion” parameter.

3) What is happening/not happening?

I can only find ways to select the “motion” parameter, with the “AllMotion” variable.

**4) Post a Green Snapshot of the piston!

5) Attach any logs (From ST IDE and by turning logging level to Full)