Check room presence

Posted on
Tue Feb 15, 2022 4:07 pm
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Check room presence

Hi all,

as already written in other thread, I am testing the ESPresense Project though HomeAssistant; the setup is as follows:

- rPi with HomeAssistant
- 2x ESP32 board with ESPresense installed, one for every room I want to check

In Indigo I get the status of the device (iPhone, watch and so on) I want to track; the status is basically the room where the device is, so far, so good.

I created a variable which gets incremented when a devices enters a room, but now my problem is to know when a device leaves the room, example:

- iPhone enters bedroom --> status gets updated --> variable gets updated --> action
- iPhone leaves bedroom --> status will change to something else, but I do not know that the previous status was "bedroom"

Any hints/ideas?

Thanks
Marco

Posted on
Sun Feb 20, 2022 12:38 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Check room presence

It sounds like the simplest way is to make extra variables, something like “previousRoom” and “thisRoom.”

Pseudocode:

if(device.state changes)
previousRoom = thisRoom
ThisRoom = device.state

Alternately, for each room you could put a dict of all the regular occupants and a flag for whether they are in that room or not, but this requires python coding.

Am I understanding the problem correctly?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests