Record real world activity for playback as Virtual Occupancy

For those who want an OH native way that uses persistence to do this see Presence Simulation - #4 by rlkoshak. There are several tutorials that cover doing this with CalDav as well.

It’s pretty much a one liner Rule.

rule "Simulate lights"
when
    Time cron "0 0/5 * * * ?"
then
    if(PresenceSim.state == ON){
        gLights.members.forEach[light | light.sendCommand(light.historicState(now.minusHours(24*7)).state)]
    }
end

That will replay the light states to whatever they were at this same time one week ago.

That was mine. I don’t know that it’s more convincing but it is pretty easy to implement and doesn’t require anything special external beyond persistence which many of us have set up already.

I never turned this into a separate tutorial or DP.

Thanks for posting the later topic. I forgot that the approach was refined quite a bit in that thread. That is probably why I never turned it into a tutorial. By the time we get to Dim’s example it was more other people’s code than mine.

1 Like