I’m trying to write some JS code in HomeyScript, that can access my solar power ECU.
Basically, I want to open a socket, write something to it and wait for the response.
I have a small Python script that is working, but I can’t get it to work in JS on HomeyScript.
The problem is with the socket: I can’t figure out what Homey supports or how to write the right code. Could anyone help me out?
The Python code that works(outside of Homey) is this:
I’m not an expert on this, but could fetch be “misused” to do what the Python script does?
I noticed that using fetch in HomeyScript, the code seems to open a socket, but I don’t know how I could then “write” something to that socket. After a while HomeyScript output shows that the socket was closed again.
I doubt it, it’s fully geared towards the HTTP protocol. It uses standard TCP communication under the hood, but I don’t see how you can tap into that to “abuse” it.