Configuring a Custom Bluetooth Occupancy Sensor?

Hey Everybody,

I am a part of a research team that is using Home Assistant to record occupancy sensor data but ran into some problems for custom-built sensors. There is another research team that is going to send my team a custom-built Bluetooth occupancy sensor (all I know about it right now), and I need to configure it to Home Assistant to record data. I have had trouble finding documentation to help me solve this problem. So far, I looked into building an integration using python but was wondering if there was another way to configure custom sensors to Home Assistant. Anything that helps point me in the right direction will really help.

Thank you in advance.

Can you have it send data over MQTT? Then you can just use the existing MQTT device trackers.

That’s how the monitor tracker does it (which, coincidentally, is a Bluetooth tracker).

Yes, I believe I can @Tinkerer, but my only concern is that once a Bluetooth connection is established, the state will continually be reported as “home.”

Well, that’s a thing for the software to handle :wink:

A device tracker will report a device as home when it is responding/broadcasting and then away when it isn’t. There’s sometimes a buffer, so that things aren’t flipping between the two states, but that it takes (say) three missed responses before it’s marked as away.

Ultimately, HA will record whatever you send it. The simplest way of sending it is MQTT. It’s up to you to build that interface to account for whatever it is you need. Or just ditch the custom built thing and use monitor :stuck_out_tongue:

1 Like

So a PIR occupancy sensor can work with monitor?

Sorry if it appears like I am asking the question you already answered, I just want to make sure I understand it.

You never said what kind of sensor it was…

No, monitor is for tracking Bluetooth devices - whether they’re present or not.

For what you’re doing a simple MQTT binary sensor would fit the bill. It even supports automatically turning the sensor off when no on message is received for a given time.

1 Like

Sorry for not making it clear, I just know it is some kind of sensor (could be a beacon, like Chipolo or a PIR sensor).

Thank you for your help @Tinkerer. I really appreciate it!!!

No worries. If it’s a beacon, I’d honestly use monitor - it’s done, and it works.

If it’s something else, connect it to the appropriate MQTT integration and most of the hard work is done for you.

1 Like

Could anyone explain how to apply MQTT binary sensor? I spent a lot time trying to figure it out today, but I am currently stuck on it. So far, it appears Home Assistant may need esp32 as bridge to connect a binary sensor, but is there a way connect MQTT directly to a Bluetooth PIR occupancy sensor without flashing?

P.S. The reason why I want to know if I can do it without flashing is because I do not know if it is possible on the sensor I will receive from the other team.

Yes, if that’s purely Bluetooth you need a “bridge”, or to create a custom component. Bluetooth PIRs are pretty uncommon, so there’s no existing integration.

1 Like