March 13, 2021

SignalK switch with NodeRed and WilhelmSK

Updated 2021-03-13 !

Here I'm trying to do the "ultimate" SignalK switch blog post including(no N2K)
  • Shelly 1 as the hardware switch
  • NodeRed as the function engine
  • NodeRed dashboard as input/output interface
  • WilhelmSK as input/output, check picture
  • A http endpoint as state sensing
The post is ment to be a template where you can pick the parts which are right for your setup.

Before you start coding check Remark below.

Prerequisites is 

The flow

The flow, handling the anchor light switch, is in initialized at the inject node "Sense interval" which builds an URL, for a http request, which response is the status of the switch. 

The status 0/1 is sent to the SK server
  • as a delta with path "electrical.switches.anchorLight.state"
  • as color black/green to the NR template node which is the actual switch button in NR
In the setup you can use one of two ways to sense changes in the S1
  • One is using, and change, the inject node "Sense interval" so that it every second polls the switch
  • Another one is using the very nice function in S1 which is called "I/O URL actions"
The last function is used here and you set it up in the S1 GUI. In this case two URL:s is set upp

OUTPUT SWITCHED ON URL   => http://zest:3000/plugins/signalk-node-red/redApi/shelly/1
OUTPUT SWITCHED OFF URL => http://zest:3000/plugins/signalk-node-red/redApi/shelly/0

These two URL:s are picked upp by the http endpoint "Sense Shelly sts" and the status is sent to the SK server. 

So whatever action, breaker on the S1 input, using NR dashboard, using WSK, inject nodes ON/OFF, triggered the action the SK server will get the status.

In WSK you have to set up the S1 as a "Switch" connected to the path "electrical.switches.anchorLight.state" and then it will appear in the GUI. When you click on the switch in the WSK GUI it will do a PUT with its selected status. This paths status will be sensed by the "signalk-put-handler" and will send ON/OFF to S1 via the http request node.

Please note that the color on the NR button is green when its ON and black when its OFF. This is due to matching the chosen colors in WSK.


Thanks to @sbender for the great WSK app and help with put-handler.

Remark
@sbender have done it again and supplied us with plugins for digital switching.

Plugin for 

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !