open-horizon-services / service-liquid-prep

3 stars 4 forks source link

Add websocket support #15

Closed playground closed 1 year ago

playground commented 1 year ago

Still experimental, this will give us options depending on the environment.
It takes about 20s to open the socket, connect and receive the sensor data. This is ideal for automation and collecting data passively. And adding esp-now communication protocol we can technically chain/bridge the sensors to collect data from all other sensors. Esp-now has a range of up to 480m. The last esp32(the closest to the gateway) should send data to the express server running on the gateway via WebSocket whenever a new update comes from any of the sensors out on the field. The data should be stored in the local db with the sensor ID.

There is a firmware branch here with WebSocket support

playground commented 1 year ago

@Adamlip1334 can you take a look at this?

Adamlip1334 commented 1 year ago

.

playground commented 1 year ago

@Adamlip1334, while I'm testing the new sensor hardware, I fixed a couple of minor bugs in the firmware that was preventing the Bluetooth from functioning if it's unable to join the wifi. I created a new version of the firmware and added websocket-client https://github.com/Liquid-Prep/LiquidPrep-Hardware/tree/websocket so we can communicate with the express server. And I also created a branch websocket-esp-now https://github.com/open-horizon-services/service-liquid-prep/tree/websocket-esp-now that you can start integrating your esp-now work. Thanks.

Adamlip1334 commented 1 year ago

@playground I see in the websocket-esp-now branch it will (when implemented) pull from the websocket into express. Should I create another branch so that there is a firmware that has both esp-now and websocket support?

playground commented 1 year ago

@Adamlip1334 you can work off of this branch https://github.com/open-horizon-services/service-liquid-prep/tree/websocket-esp-now, it's intended for you to implement esp-now functionality.

Adamlip1334 commented 1 year ago

added websocket support here

Adamlip1334 commented 1 year ago

esp-now firmware without websocket support here: https://github.com/Adamlip1334/LiquidPrep-Hardware/tree/esp-now

Adamlip1334 commented 1 year ago

Looking into being able to change the esp32 mac address now

edit: added readmes with directions on how to retrieve the devices MAC address, as well as how to set a new MAC address onto the device.

playground commented 1 year ago

Websocket support has been added to esp-now-gateway and express server.