Check room presence

This forum is a place to post questions about doing things that aren't necessarily Indigo specific (though they could be). For instance:
  • How do I automate the following HTTP POST?
  • How can I restart my router periodically?
  • How can I do whole house audio?

MarcoGT
Posts: 1115
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Check room presence

Post by MarcoGT »

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
User avatar
mundmc
Posts: 1064
Joined: Fri Sep 14, 2012 4:34 pm

Re: Check room presence

Post by mundmc »

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?
Post Reply

Return to “How Do I...”