Supereg / homebridge-http-notification-server

An http/https server inside Homebridge to receive notifications from external programs
MIT License
28 stars 1 forks source link

Serial bluetooth #7

Closed Pythonaire closed 5 years ago

Pythonaire commented 5 years ago

I wrote a plugin for devices communicate along bluetooth with Homebridge, by using 'Serialport' lib. It work so far, but I like to use the idea of notification server to listen on incoming bluetooth/serial communication, instead of http. Would you give me a hint to do that?

Supereg commented 5 years ago

Okay, so that I understand that correctly. Your wrote a homebridge plugin that communicates with HomeKit over HAP (http) and than communicates with sensors over bluetooth? And now you want to implement the ability for the bluetooth device to push new values? I have absolute no knowledge how information transfer over bluetooth is handled. But the basic idea is that your bluetooth device needs to actively send data to your plugin. Does the bluetooth device does that/support that?

Pythonaire commented 5 years ago

The bluetooth device (ESPXXX) create json formed data, put that into a serialport interface and transport that over bluetooth to the raspberry periodically. The raspberry take the incoming bluetooth-serial data (terminated on /dev/rfcomm), a serialport (https://github.com/node-serialport/node-serialport; binded to my plugin) parse the json data from the incoming stream, my plugin just messing a bit with the data and push the values to the Homebridge api. No IP / http is involved. So far so good, unfortunately, I have to refresh the Homekit app each time I like to see updates.I want to use bluetooth, because Wifi is very power hungry, not a good idea on battery powered sensor devices.

Update: I got BLE running on the Raspi Zero W and communicating with the sensor. I could use noble node.js server etc. but seems to be a bit unstable on the ARM6l Raspi Zero W ,but I will go deeper with that kind of solutions.

Thx for your attention, issue can be closed on my side.