Searching around the net, I found that I could use the SensorPush BLE API and SensorPushBleak to get data from the device on demand. I made a little python script to run on a separate Raspberry pi 3 and get sensor data on demand - works pretty good.
Hopefully, without adding more hardware to my whole setup, I’d like to be able to run the above functionality to poll the SensorPush device from within Home Assistant. Here’s what I’ve tried:
As of today, I’m investigating using the ESPHome BLE Client Sensor to query the SenorPush device - looks promising (?)
I’m only about 3 days into working with Home Assistant and this issue, but thought I’d reach out to this excellent community for comments on attacking this goal of getting data on demand from a SensorPush sensor.
Thanks in advance for your consideration and comments.
John
Found a solution, thought I’d post it. Created the ble_client, and a sensor for it. Sensor has 3 characteristics - Temp, humidity and voltage. Values are polled every 15 seconds for temp and humidity, the voltage polls at a minute as shown in the yaml below. I also created a Switch (named
Initiate SensorPush Write) to write to the temperature characteristic, which triggers a sensor reading internally on the SensorPush device - according to this link.
In HomeAssistant, I set up an automation to “Turn On” the "Initiate SensorPush Write " switch every 15 seconds - BAM! fresh sensor reading every 15 seconds or so… Kind of clunky, but it works. Currently investigating a better way of doing the ble_client.ble_write - getting rid of the switch would be nice, but also would like an easy way of adjusting the timing.
Also have a switch to turn off the ble_client. This is nice so that I can disconnect the ESP and connect to the SensorPush with the iOS or android app to double check values that I’m getting from the ESP.
Will update if I have a more elegant solution as I really wanted to:
Could you solve the ble_client connection only for the time of read/write values? How much the permanent connection affects the battery?
I would like to just read the battery once a day, and send alert to my device trackers if needed, but don’t want to keep a client connection alive to eat the battery.
Thx!