Skip to content

Commit d78cffc

Browse files
committed
chore: switch automation
1 parent 439822c commit d78cffc

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

examples/switch-automation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"id":"cf96057a.038f88","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"4f82f0b0.ea4f5","type":"inject","z":"cf96057a.038f88","name":"Trigger Poll","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":120,"wires":[["f3cc3b94.c5e49","235e9b3d.b4f944"]]},{"id":"f3cc3b94.c5e49","type":"function","z":"cf96057a.038f88","name":"Check Anchor Light","func":"\n\nlet _ = global.get('lodash')\nlet app = global.get('app')\n\nlet sog = app.getSelfPath('navigation.speedOverGround.value')\nlet acVoltage = app.getSelfPath('electrical.inverters.261.acin.voltage.value')\nlet rpm = app.getSelfPath('propulsion.port.revolutions.value')\nlet sun = app.getSelfPath('environment.sun.value')\nlet state = app.getSelfPath('electrical.switches.venus-1.state.value')\n\nlet res = false\nif ( !_.isUndefined(acVoltage) && !_.isUndefined(sog) && !_.isUndefined(sun) ) {\n res = (_.isUndefined(rpm) || rpm === 0) && sog < 0.5 && sun !== 'day'\n //res = 1\n}\n\nif ( res === false ) {\n node.status({fill:\"red\",shape:\"ring\",text:\"off\"});\n} else {\n node.status({fill:\"green\",shape:\"dot\",text:\"on\"});\n}\n\nif ( state != res ) {\n return {payload: res ? 1 : 0 }\n}","outputs":1,"noerr":0,"x":340,"y":60,"wires":[["8cd816d5.e67028"]]},{"id":"8cd816d5.e67028","type":"signalk-send-put","z":"cf96057a.038f88","name":"Anchor Light","path":"electrical.switches.venus-1.state","x":570,"y":60,"wires":[]},{"id":"235e9b3d.b4f944","type":"function","z":"cf96057a.038f88","name":"Check ACR","func":"\nlet _ = global.get('lodash')\nlet app = global.get('app')\n\nlet mode = app.getSelfPath('electrical.chargers.261.chargingMode.value')\nlet rpm = app.getSelfPath('propulsion.port.revolutions.value')\nlet state = app.getSelfPath('electrical.switches.venus-0.state.value')\n\nlet res = false\nif ( !_.isUndefined(mode) && !_.isUndefined(rpm) ) {\n res = (mode === 'off' || mode === 'inverting') && rpm > 0\n}\n\nif ( res === false ) {\n node.status({fill:\"red\",shape:\"ring\",text:\"off\"});\n} else {\n node.status({fill:\"green\",shape:\"dot\",text:\"on\"});\n}\n\nif ( state != res ) {\n return {payload: res ? 1 : 0 }\n}","outputs":1,"noerr":0,"x":310,"y":180,"wires":[["222ecb4.3b9b634"]]},{"id":"222ecb4.3b9b634","type":"signalk-send-put","z":"cf96057a.038f88","name":"ACR","path":"electrical.switches.venus-0.state","x":550,"y":180,"wires":[]}]

examples/switch-on-anchor-light.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)