I can probably muddle my way through this but I’d like to hear some best practice.
I have a teenage son and daughter who are in and out of their rooms irregularly. Each room has a Vallhorn motion sensor and a Mytek panel heater, which has a Tuya-controlled thermostat.
I’d like to heat the room when it’s occupied and when it’s below 20 degrees C. I’d like to avoid turning the heater on when someone enters the room for a short amount of time. It can turn off when there’s no motion because they’re sleeping, but that isn’t essential.
I’d like to avoid buying a presence sensor if possible.
I don’t want to to just come to on and off as it detects movement as it would be going on and off quite frequently.
But somehow establishes when someone’s in the room and consistently warms the room then turns it off when they’re not around.
For instance, if there’s movement for more than a solid minute then it’s safe to say someone’s in there. And if there’s movement of that type within the last half hour of that type then assume they’re still in there.
Feels like there are settings and rules that could be set to allow this to work well, but I’m not quite sure what they are and figure someone else has probably worked it out.
Sure, no problem. Depending on the details, a simple for in the automation’s trigger could be enough, or you could make a separate timer helper that would keep the timings.
From my personal experience, only (mmwave) Aqara FP2 is working perfectly as a presence sensor. With simple PIR motion detectors, u will have to compromise.
Automation 1: whenstate of the motion detector changed from not detected to detectedfor1 minutethenincrease the temperature.
Automation 2: whenstate of motion detector changes to from detected to not detected (notice: end of a movement)for30 minthenlower the temperature.
although – per a common on this forum recommendation – I’ll encourage you not to use a Device trigger type → use Entity->State trigger type → it makes for a more readable YAML code (and other profits in the long term)
This will trigger on the OCCUPIED → NOT OCCUPIED state change for over 30 minutes → and then lower the temp to 16 degrees. So… I’m guessing this is what you want
Notice, in this case, you’re also pointing to the device_id (and the ID is “unreadable”) → you may want to switch it to entity_id instead.
BTW, test your setup. Change the 30 min into 3 min temporarily → and observe if it works the way you want it.