MV 2 Umbrellas - hello folks ... I am working o...

hello folks ... I am working on a an esp32/signalk project for my generators onboard ... I am able to send data like oil pressure, coolant temp via signalk to a dashboard I am now hoping to be able to send a stop signal back to the generator ... is there a way to make the system "2 way"? ie send a command back over the websocket to be handled by the esp32 ?
7 Replies
Tony
Tony3mo ago
what will the esp32 do if it receives a command? You can poll Signalk on an interval or use MQTT and have the Esp32 read messages published from Node Red
Teppo Kurki
Teppo Kurki3mo ago
Polling introduces lag
MV 2 Umbrellas
MV 2 UmbrellasOP3mo ago
basically will toggle some relays on attached to the esp32 ... these relays control the fuel rack solenoid and alternator exciter on the generator ... I was hoping to avoid polling if possible Is there a websocket connection established between clients and the signalk server? or are clients just talking via more traditional http get/post
Tony
Tony3mo ago
I’m pretty sure that sensesp uses websocket protocol to connect to Signalk. I suggested polling because it is a very simple and easy way to connect to Signalk over REST to get any path value. Lag is only a concern if you need to respond to a command immediately. I have a Shelly relay that I send a command to using MQTT in Node Red. I am polling Signalk every 10 minutes to determine state of change
MV 2 Umbrellas
MV 2 UmbrellasOP3mo ago
Hi Tony ... for this scenario I would probably want to poll every 2 seconds or so ... quite a bit of polling for sure !
Tony
Tony3mo ago
Check out Teppo's mqtt plugin. This is how I would approach it. https://github.com/tkurki/signalk-mqtt-gw
Jan Dytrych
Jan Dytrych3mo ago
You can use SK PUT to send command and then emit result in another PATH or same PATH. For example SK PUT at path 'generator.x.control' with value '0' and it will update the status with '0' when it stops. When generator is running value will be 1, it's basically relay, isn't it? it will be similar to this one: https://github.com/JohnySeven/Boat-T-RelayS3/blob/10051bed248666da65e35f1fca8b486c07c36730/src/main.cpp#L23
Want results from more Discord servers?
Add your server