Hello,
I have set up an ac that reacts to temperature sensor data coming from a python script. Can you please guide me on how to turn off ac automatically after 7 pm? Also, how can I run the python script at a certain time like from 6 am to 7 pm? I have added my current flow. Your help will be greatly appreciated. Thank you
[
{
"id": "0a5f190822b330f1",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "b3cba65475e17eb1",
"type": "rbe",
"z": "0a5f190822b330f1",
"name": "",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 1420,
"y": 1040,
"wires": [
[
"2ca43eb7563c07f2"
]
]
},
{
"id": "2ca43eb7563c07f2",
"type": "switch",
"z": "0a5f190822b330f1",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1550,
"y": 1040,
"wires": [
[
"85be91facbaac711"
],
[
"7ba58268ded90e6f"
]
]
},
{
"id": "85be91facbaac711",
"type": "change",
"z": "0a5f190822b330f1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[{\"topic\":\"power\",\"payload\":\"on\"},{\"topic\":\"mode\",\"payload\":\"cool\"}]",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1760,
"y": 980,
"wires": [
[
"e69c3e5a157c1679"
]
]
},
{
"id": "7ba58268ded90e6f",
"type": "change",
"z": "0a5f190822b330f1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[{\"topic\":\"power\",\"payload\":\"off\"}]",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1760,
"y": 1040,
"wires": [
[
"e69c3e5a157c1679"
]
]
},
{
"id": "e69c3e5a157c1679",
"type": "split",
"z": "0a5f190822b330f1",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 1990,
"y": 1020,
"wires": [
[
"732f1b1e89a3e7d5"
]
]
},
{
"id": "732f1b1e89a3e7d5",
"type": "delay",
"z": "0a5f190822b330f1",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"outputs": 1,
"x": 1290,
"y": 1140,
"wires": [
[
"fde8db8c7fa6e9ae"
]
]
},
{
"id": "fde8db8c7fa6e9ae",
"type": "change",
"z": "0a5f190822b330f1",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.topic",
"pt": "msg",
"to": "topic",
"tot": "msg"
},
{
"t": "move",
"p": "payload.payload",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1510,
"y": 1140,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "2aff020d0e115066",
"type": "rbe",
"z": "0a5f190822b330f1",
"name": "",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"x": 650,
"y": 880,
"wires": [
[
"f8a64bda2398f4e4",
"d32bc1fdbdb31516"
]
]
},
{
"id": "aee76045468e8fd0",
"type": "ui_dropdown",
"z": "0a5f190822b330f1",
"name": "",
"label": "Vertical swing ",
"tooltip": "",
"place": "Select option",
"group": "5c569ec8.d608f",
"order": 6,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "Default",
"value": "default",
"type": "str"
},
{
"label": "Swing in full range",
"value": "full",
"type": "str"
},
{
"label": "Fixed top",
"value": "fixedTop",
"type": "str"
},
{
"label": "Fixed mid-top",
"value": "fixedMidTop",
"type": "str"
},
{
"label": "Fixed mid",
"value": "fixedMid",
"type": "str"
},
{
"label": "Fixed mid-bottom",
"value": "fixedMidBottom",
"type": "str"
},
{
"label": "Fixed bottom",
"value": "fixedBottom",
"type": "str"
},
{
"label": "Swing bottom",
"value": "swingBottom",
"type": "str"
},
{
"label": "Swing mid-bottom",
"value": "swingMidBottom",
"type": "str"
},
{
"label": "Swing mid",
"value": "swingMid",
"type": "str"
},
{
"label": "Swing mid top",
"value": "swingMidTop",
"type": "str"
},
{
"label": "Swing top",
"value": "swingTop",
"type": "str"
}
],
"payload": "",
"topic": "swingVert",
"topicType": "str",
"className": "",
"x": 440,
"y": 460,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "6a82621380e24614",
"type": "ui_dropdown",
"z": "0a5f190822b330f1",
"name": "",
"label": "Horizontal swing ",
"tooltip": "",
"place": "Select option",
"group": "5c569ec8.d608f",
"order": 5,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "Default",
"value": "default",
"type": "str"
},
{
"label": "Full",
"value": "full",
"type": "str"
},
{
"label": "Fixed left",
"value": "fixedLeft",
"type": "str"
},
{
"label": "Fixed mid-left",
"value": "fixedMidLeft",
"type": "str"
},
{
"label": "Fixed mid",
"value": "fixedMid",
"type": "str"
},
{
"label": "Fixed mid-right",
"value": "fixedMidRight",
"type": "str"
},
{
"label": "Fixed right",
"value": "fixedRight",
"type": "str"
},
{
"label": "Full alt",
"value": "fullAlt",
"type": "str"
}
],
"payload": "",
"topic": "swingHor",
"topicType": "str",
"className": "",
"x": 440,
"y": 520,
"wires": [
[
"2aff020d0e115066"
]
],
"info": "Controls the swing mode of the horizontal air blades (not available on all units)"
},
{
"id": "80f433b87f4776ac",
"type": "ui_dropdown",
"z": "0a5f190822b330f1",
"name": "",
"label": "Fan speed",
"tooltip": "",
"place": "Select option",
"group": "5c569ec8.d608f",
"order": 4,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "Auto",
"value": "auto",
"type": "str"
},
{
"label": "Low",
"value": "low",
"type": "str"
},
{
"label": "Medium low",
"value": "mediumLow",
"type": "str"
},
{
"label": "Medium",
"value": "medium",
"type": "str"
},
{
"label": "Medium high",
"value": "mediumHigh",
"type": "str"
},
{
"label": "High",
"value": "high",
"type": "str"
}
],
"payload": "",
"topic": "fanSpeed",
"topicType": "str",
"className": "",
"x": 430,
"y": 400,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "5d7b2dda548ea6bb",
"type": "ui_dropdown",
"z": "0a5f190822b330f1",
"name": "",
"label": "Mode",
"tooltip": "",
"place": "Select option",
"group": "5c569ec8.d608f",
"order": 3,
"width": "0",
"height": "0",
"passthru": false,
"multiple": false,
"options": [
{
"label": "Auto",
"value": "auto",
"type": "str"
},
{
"label": "Cool",
"value": "cool",
"type": "str"
},
{
"label": "Dry",
"value": "dry",
"type": "str"
},
{
"label": "Fan only",
"value": "fan_only",
"type": "str"
},
{
"label": "Heat",
"value": "heat",
"type": "str"
}
],
"payload": "",
"topic": "mode",
"topicType": "str",
"className": "",
"x": 430,
"y": 240,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "2c3803e175c14299",
"type": "ui_switch",
"z": "0a5f190822b330f1",
"name": "",
"label": "Power",
"tooltip": "",
"group": "5c569ec8.d608f",
"order": 1,
"width": "0",
"height": "0",
"passthru": false,
"decouple": "true",
"topic": "power",
"topicType": "str",
"style": "",
"onvalue": "on",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "off",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"animate": true,
"className": "",
"x": 430,
"y": 160,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "e034be5020e5165c",
"type": "ui_switch",
"z": "0a5f190822b330f1",
"name": "",
"label": "Lights",
"tooltip": "",
"group": "5c569ec8.d608f",
"order": 9,
"width": "3",
"height": "1",
"passthru": false,
"decouple": "true",
"topic": "lights",
"topicType": "str",
"style": "",
"onvalue": "on",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "off",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"animate": true,
"className": "",
"x": 410,
"y": 700,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "58a6ca227f255b65",
"type": "ui_switch",
"z": "0a5f190822b330f1",
"name": "",
"label": "Power save",
"tooltip": "",
"group": "5c569ec8.d608f",
"order": 10,
"width": "3",
"height": "1",
"passthru": false,
"decouple": "true",
"topic": "powerSave",
"topicType": "str",
"style": "",
"onvalue": "on",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "off",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"animate": true,
"className": "",
"x": 430,
"y": 760,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "85c6129db8fc0c16",
"type": "ui_switch",
"z": "0a5f190822b330f1",
"name": "",
"label": "Cold plasma",
"tooltip": "",
"group": "5c569ec8.d608f",
"order": 7,
"width": "3",
"height": "1",
"passthru": false,
"decouple": "true",
"topic": "health",
"topicType": "str",
"style": "",
"onvalue": "on",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "off",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"animate": true,
"className": "",
"x": 430,
"y": 580,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "867709092587f839",
"type": "ui_switch",
"z": "0a5f190822b330f1",
"name": "",
"label": "X-Fan",
"tooltip": "",
"group": "5c569ec8.d608f",
"order": 8,
"width": "3",
"height": "1",
"passthru": false,
"decouple": "true",
"topic": "blow",
"topicType": "str",
"style": "",
"onvalue": "on",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "off",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"animate": true,
"className": "",
"x": 410,
"y": 640,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "19785ce509b23596",
"type": "ui_numeric",
"z": "0a5f190822b330f1",
"name": "",
"label": "Temperature",
"tooltip": "",
"group": "5c569ec8.d608f",
"order": 2,
"width": 0,
"height": 0,
"wrap": false,
"passthru": false,
"topic": "temperature",
"topicType": "str",
"format": "{{value}}",
"min": "23",
"max": "25",
"step": 1,
"className": "",
"x": 430,
"y": 320,
"wires": [
[
"2aff020d0e115066"
]
]
},
{
"id": "f8a64bda2398f4e4",
"type": "gree-hvac",
"z": "0a5f190822b330f1",
"name": "AC-Room 1",
"device": "fb5f648e10ccac25",
"interval": "1",
"debug": false,
"x": 80,
"y": 820,
"wires": [
[
"d32bc1fdbdb31516"
],
[
"9c39fbfb4a69841d",
"d32bc1fdbdb31516"
]
],
"info": "const Gree = require('gree-hvac-client');\r\n\r\nmodule.exports = function (RED) {\r\n function GreeHvacNode(config) {\r\n RED.nodes.createNode(this, config);\r\n const node = this;\r\n const device = RED.nodes.getNode(config.device);\r\n\r\n node.status({});\r\n\r\n const pollingInterval = config.interval * 1000;\r\n let client = new Gree.Client({\r\n host: device.host,\r\n pollingInterval: pollingInterval,\r\n pollingTimeout: pollingInterval / 2,\r\n debug: config.debug\r\n });\r\n\r\n const statusConnected = () => {\r\n node.status({fill: 'green', shape: 'dot', text: 'connected to ' + client.getDeviceId()})\r\n };\r\n\r\n const statusConnecting = () => node.status({fill: 'yellow', shape: 'dot', text: 'connecting...'});\r\n const statusNoResponse = () => node.status({fill: 'yellow', shape: 'dot', text: 'no response...'});\r\n\r\n statusConnecting();\r\n\r\n client.on('connect', statusConnected);\r\n client.on('update', (updatedProperties, properties) => {\r\n statusConnected();\r\n node.send([{\r\n topic: 'updated',\r\n payload: updatedProperties\r\n }, {\r\n topic: 'properties',\r\n payload: properties\r\n }]);\r\n });\r\n client.on('success', (updatedProperties, properties) => {\r\n node.send([{\r\n topic: 'acknowledged',\r\n payload: updatedProperties\r\n }, {\r\n topic: 'properties',\r\n payload: properties\r\n }]);\r\n });\r\n client.on('disconnect', statusConnecting);\r\n client.on('no_response', statusNoResponse);\r\n\r\n this.on('input', function (msg) {\r\n if (typeof msg.payload === \"object\")\r\n client.setProperties(msg.payload);\r\n else\r\n client.setProperty(msg.topic, msg.payload);\r\n });\r\n\r\n this.on('close', function () {\r\n client.disconnect();\r\n client = null;\r\n });\r\n }\r\n\r\n RED.nodes.registerType('gree-hvac', GreeHvacNode);\r\n};"
},
{
"id": "d32bc1fdbdb31516",
"type": "debug",
"z": "0a5f190822b330f1",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 330,
"y": 880,
"wires": []
},
{
"id": "059a0e3b08b8e980",
"type": "switch",
"z": "0a5f190822b330f1",
"name": "",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "power",
"vt": "str"
},
{
"t": "eq",
"v": "mode",
"vt": "str"
},
{
"t": "eq",
"v": "temperature",
"vt": "str"
},
{
"t": "eq",
"v": "fanSpeed",
"vt": "str"
},
{
"t": "eq",
"v": "swingVert",
"vt": "str"
},
{
"t": "eq",
"v": "swingHor",
"vt": "str"
},
{
"t": "eq",
"v": "health",
"vt": "str"
},
{
"t": "eq",
"v": "blow",
"vt": "str"
},
{
"t": "eq",
"v": "lights",
"vt": "str"
},
{
"t": "eq",
"v": "powerSave",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 10,
"x": 210,
"y": 640,
"wires": [
[
"2c3803e175c14299"
],
[
"5d7b2dda548ea6bb"
],
[
"19785ce509b23596"
],
[
"80f433b87f4776ac"
],
[
"aee76045468e8fd0"
],
[
"6a82621380e24614"
],
[
"85c6129db8fc0c16"
],
[
"867709092587f839"
],
[
"e034be5020e5165c"
],
[
"58a6ca227f255b65"
]
]
},
{
"id": "9c39fbfb4a69841d",
"type": "split",
"z": "0a5f190822b330f1",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "topic",
"x": 70,
"y": 640,
"wires": [
[
"059a0e3b08b8e980"
]
]
},
{
"id": "83da7ce6e9941a15",
"type": "pythonshell in",
"z": "0a5f190822b330f1",
"name": "",
"pyfile": "/home/pi3/Desktop/ac.py",
"virtualenv": "",
"continuous": true,
"stdInData": false,
"x": 860,
"y": 640,
"wires": [
[
"af0e7678ad437da6"
]
]
},
{
"id": "2e20212159b0a6db",
"type": "debug",
"z": "0a5f190822b330f1",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1570,
"y": 600,
"wires": []
},
{
"id": "a27724f700ed4dd0",
"type": "change",
"z": "0a5f190822b330f1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$number(payload)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1300,
"y": 640,
"wires": [
[
"2e20212159b0a6db",
"0cbe4728813c94f4"
]
]
},
{
"id": "af0e7678ad437da6",
"type": "function",
"z": "0a5f190822b330f1",
"name": "",
"func": "msg.payload= msg.payload.replace(/\\n/, \"\");\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1080,
"y": 640,
"wires": [
[
"a27724f700ed4dd0"
]
]
},
{
"id": "0cbe4728813c94f4",
"type": "change",
"z": "0a5f190822b330f1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$$.payload > 26 ? true : false",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1580,
"y": 760,
"wires": [
[
"b3cba65475e17eb1"
]
]
},
{
"id": "2aafb87171bc9011",
"type": "comment",
"z": "0a5f190822b330f1",
"name": "Set Temperature to turn on/off",
"info": "",
"x": 1620,
"y": 700,
"wires": []
},
{
"id": "5c569ec8.d608f",
"type": "ui_group",
"name": "AC",
"tab": "168c092a.469d97",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "fb5f648e10ccac25",
"type": "gree-hvac-config",
"name": "AC",
"host": "192.168.0.2"
},
{
"id": "168c092a.469d97",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]