node-red-contrib-power-saver
Version:
A module for Node-RED that you can use to turn on and off a switch based on power prices
89 lines (88 loc) • 1.89 kB
JSON
[
{
"id": "eab799518168f5a3",
"type": "ha-entity",
"z": "d938c47f.3398f8",
"name": "Info fra PS til HA",
"server": "ec4a12a1.b2be9",
"version": 2,
"debugenabled": false,
"outputs": 1,
"entityType": "sensor",
"config": [
{
"property": "name",
"value": "Powersaver"
},
{
"property": "device_class",
"value": ""
},
{
"property": "icon",
"value": ""
},
{
"property": "unit_of_measurement",
"value": ""
},
{
"property": "state_class",
"value": ""
},
{
"property": "last_reset",
"value": ""
}
],
"state": "payload",
"stateType": "str",
"attributes": [
{
"property": "Schedule",
"value": "payload.schedule",
"valueType": "msg"
},
{
"property": "Hours",
"value": "payload.hours",
"valueType": "msg"
},
{
"property": "Control",
"value": "payload.hours[0].onOff",
"valueType": "str"
},
{
"property": "Current",
"value": "payload.current",
"valueType": "str"
}
],
"resend": true,
"outputLocation": "payload",
"outputLocationType": "none",
"inputOverride": "allow",
"outputOnStateChange": false,
"outputPayload": "",
"outputPayloadType": "str",
"x": 830,
"y": 630,
"wires": [[]]
},
{
"id": "cad33a63f66ef72e",
"type": "function",
"z": "d938c47f.3398f8",
"name": "Convert true/false to 1/0",
"func": "msg.payload.hours.forEach(h => h.onOff = h.onOff ? \"1\" : \"0\")\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 550,
"y": 630,
"wires": [["eab799518168f5a3", "37a23d88cfc668f2"]]
}
]