Best practice for motion sensor and heater?

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.

Thank you!

Well, you can make some automations that will do this for you. So… what’s the exact problem? Where are you stuck?

Do you mean:

  • when both: occupied AND temp below 20?
  • when either: occupied OR temp below 20?

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: when state of the motion detector changed from not detected to detected for 1 minute then increase the temperature.

Automation 2: when state of motion detector changes to from detected to not detected (notice: end of a movement) for 30 min then lower the temperature.

Oh that’s pretty straightforward. You mean like this?

yes

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)

So like this, to turn it off?

alias: Cassius Heater Off
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.cassius_vallhorn_occupancy
    from: "on"
    to: "off"
    for:
      hours: 0
      minutes: 30
      seconds: 0
condition: []
action:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: 16
    target:
      device_id: 877eb6b781f6effe6cdae78e10349ebf
mode: single

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 :slight_smile:

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.