Aqara and Hue Motion sensors help

Please format your code properly as explained in point 11 of the community guidelines.

Binary sensors are either on or off, the states are lowercase. You are wrongly using On. Ypu can see the correct state under Developer Tools -> States