Hello,
I am a new to developing in Home Assistant, and I never done any custom integrations before.
I live in a remote area where constantly here I have energy shortages due a tree falling on the energy poles, and sometimes it takes very long to get fixed, so I brought a diesel generator, which came with a Deep Sea Electronics PLC connected to DSEWebNet Gateway(DSE890 MKII) , that is connected to the internet with the DSEWebnet.
I researched and found that there is no DSEWebNet integration for HASS, so as I am a programmer, I guess I should build one myself.
I was studying the web interface from DSEWebNet, and found out it uses websocket to read and write into the PLC of the generator.
I already can use insomnia to fully read and write what I want from the generator, its pretty simple as crafting a JSON with the codes I learn from messing around on the interface.
Basically I send a JSON requesting what information I would like to be streamed to me, and when I want to control the operation of the generator I send another JSON with the operation I want (Basically just Off, Auto, On). I could go into the details of how all this data can be crafted but I guess thats not the point.
My question would be: how do I create a custom integration that uses websocket, where at start it sends a json and starts updating sensors I define, and also to create controls which will send the corresponding json command for it to operate?
What would help a lot is another integrations that also use wss in a similar manner, or what steps should I take to get this working.
I haven’t started any coding besides scraping the webapi, so where do I start?
In HASS docs I only found websockets for interacting with the UI or with HASS, but that’s not what I want, I want an integration that uses websocket to fetch sensors and send controls.
I found this similar topic Web socket Sensor but there was no solution for it.