[ { "id": "4cf980d2dc54e8b1", "type": "inject", "z": "75c64f88.cfdf8", "name": "Status", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "device", "payloadType": "str", "x": 130, "y": 100, "wires": [ [ "73d2ad663e2a4067" ] ] }, { "id": "59c53a42c0037c5f", "type": "debug", "z": "75c64f88.cfdf8", "name": "debug 5", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 760, "y": 100, "wires": [] }, { "id": "a6cdbab04eff6556", "type": "inject", "z": "75c64f88.cfdf8", "name": "Default 14*C", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "5", "topic": "", "payload": "14", "payloadType": "num", "x": 150, "y": 200, "wires": [ [ "70c1966b5954898d" ] ] }, { "id": "73d2ad663e2a4067", "type": "zigbee2mqtt-get", "z": "75c64f88.cfdf8", "name": "", "server": "5165c872ea833f5a", "friendly_name": "SmartSocket (E1603/E1702/E1708)", "device_id": "0xf4b3b1fffe8c2b6f", "state": "0", "enableMultiple": false, "x": 440, "y": 100, "wires": [ [ "59c53a42c0037c5f" ] ] }, { "id": "70c1966b5954898d", "type": "ui_numeric", "z": "75c64f88.cfdf8", "name": "", "label": "Set Room Temp", "tooltip": "", "group": "d9012267.99b7a", "order": 2, "width": 0, "height": 0, "wrap": false, "passthru": true, "topic": "topic", "topicType": "msg", "format": "{{value + \" °C\"}}", "min": 0, "max": "30", "step": "0.5", "className": "", "x": 160, "y": 260, "wires": [ [ "1f3621fcdb209e35" ] ] }, { "id": "1f3621fcdb209e35", "type": "change", "z": "75c64f88.cfdf8", "name": "Topic = Desired", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Desired", "tot": "str" }, { "t": "set", "p": "desired", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 460, "y": 260, "wires": [ [ "4aae2257378b817b" ] ] }, { "id": "4aae2257378b817b", "type": "debug", "z": "75c64f88.cfdf8", "name": "debug 34", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 720, "y": 260, "wires": [] }, { "id": "743e736f3deed2e7", "type": "inject", "z": "75c64f88.cfdf8", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "OFF", "payloadType": "str", "x": 930, "y": 420, "wires": [ [ "57669f8eabf6d38f" ] ] }, { "id": "1fc87d0bcc6c972a", "type": "debug", "z": "75c64f88.cfdf8", "name": "debug 47", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 680, "y": 540, "wires": [] }, { "id": "57669f8eabf6d38f", "type": "zigbee2mqtt-out", "z": "75c64f88.cfdf8", "name": "", "server": "5165c872ea833f5a", "friendly_name": "SmartSocket (E1603/E1702/E1708)", "device_id": "0xf4b3b1fffe8c2b6f", "command": "state", "commandType": "z2m_cmd", "payload": "payload", "payloadType": "msg", "optionsValue": "", "optionsType": "nothing", "x": 960, "y": 480, "wires": [] }, { "id": "274c19d71b8081a6", "type": "ui_switch", "z": "75c64f88.cfdf8", "name": "", "label": "SmartSocket OFF/ON", "tooltip": "", "group": "d9012267.99b7a", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "topicType": "str", "style": "", "onvalue": "ON", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "OFF", "offvalueType": "str", "officon": "", "offcolor": "", "animate": true, "className": "", "x": 180, "y": 340, "wires": [ [ "f074515e87f3cd31" ] ] }, { "id": "ceb680872de05c45", "type": "function", "z": "75c64f88.cfdf8", "name": "Should socket be OFF or ON", "func": "var ruuvi = flow.get(\"ruuvi\");\nvar desired = flow.get(\"desired\");\nvar OnOff = flow.get(\"OnOff\");\nvar state = flow.get(\"state\");\nif(OnOff === \"ON\"){// have I turned it ON?\n if(ruuvi > desired){// is it above set temp?\n if(state != \"OFF\"){// if returned is still ON\n msg.topic = \"Turn-OFFON\";\n msg.payload = \"OFF\";// turn it OFF\n }\n }else if(ruuvi <= desired - 0.02){// it's below set temp minus hysteresis\n if(state != \"ON\"){// if returned is still OFF\n msg.topic = \"Turn-OFFON\";\n msg.payload = \"ON\";// turn it on\n }\n }\n}else if(OnOff === \"OFF\"){\n if(state != \"OFF\"){\n msg.topic = \"Turn-OFFON\";\n msg.payload = \"OFF\";// if all else fails, force it OFF\n }\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 440, "y": 480, "wires": [ [ "b1aff00e9724a804", "9c8597889e68a74c" ] ] }, { "id": "f074515e87f3cd31", "type": "change", "z": "75c64f88.cfdf8", "name": "Topic = OnOff", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "OnOff", "tot": "str" }, { "t": "set", "p": "OnOff", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 460, "y": 340, "wires": [ [] ] }, { "id": "b1aff00e9724a804", "type": "switch", "z": "75c64f88.cfdf8", "name": "", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", "v": "Turn-OFFON", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 690, "y": 480, "wires": [ [ "1fc87d0bcc6c972a", "57669f8eabf6d38f" ] ] }, { "id": "9c8597889e68a74c", "type": "debug", "z": "75c64f88.cfdf8", "name": "debug 46", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 400, "y": 420, "wires": [] }, { "id": "c0b66d3b4c7b3df3", "type": "inject", "z": "75c64f88.cfdf8", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "ON", "payloadType": "str", "x": 930, "y": 540, "wires": [ [ "57669f8eabf6d38f" ] ] }, { "id": "35ea7389e6bf3e22", "type": "zigbee2mqtt-bridge", "z": "75c64f88.cfdf8", "name": "", "server": "5165c872ea833f5a", "topic": null, "x": 250, "y": 940, "wires": [ [ "867272b0ad79463d", "322afd3fa7e777f6" ] ] }, { "id": "867272b0ad79463d", "type": "debug", "z": "75c64f88.cfdf8", "name": "debug 50", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 520, "y": 940, "wires": [] }, { "id": "322afd3fa7e777f6", "type": "switch", "z": "75c64f88.cfdf8", "name": "genOnOff State", "property": "payload.message", "propertyType": "msg", "rules": [ { "t": "cont", "v": "genOnOff.off", "vt": "str" }, { "t": "cont", "v": "genOnOff.on", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 580, "y": 980, "wires": [ [ "d4ee1877f3745f5c" ], [ "5c8fdda809210cf3" ] ] }, { "id": "51aa2adaf2b601e3", "type": "debug", "z": "75c64f88.cfdf8", "name": "debug 51", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 760, "y": 980, "wires": [] }, { "id": "8dff1384ea4f3f43", "type": "debug", "z": "75c64f88.cfdf8", "name": "debug 53", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 760, "y": 1020, "wires": [] }, { "id": "5c8fdda809210cf3", "type": "change", "z": "75c64f88.cfdf8", "name": "Topic = State ON", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "State", "tot": "str" }, { "t": "set", "p": "state", "pt": "flow", "to": "ON", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 770, "y": 1060, "wires": [ [ "8dff1384ea4f3f43" ] ] }, { "id": "d4ee1877f3745f5c", "type": "change", "z": "75c64f88.cfdf8", "name": "Topic = State OFF", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "State", "tot": "str" }, { "t": "set", "p": "state", "pt": "flow", "to": "OFF", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 750, "y": 920, "wires": [ [ "51aa2adaf2b601e3" ] ] }, { "id": "acbd9d9e107ad1a1", "type": "inject", "z": "75c64f88.cfdf8", "name": "", "props": [ { "p": "payload" } ], "repeat": "1", "crontab": "", "once": false, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "num", "x": 150, "y": 480, "wires": [ [ "ceb680872de05c45" ] ] }, { "id": "396f53bff34dd64d", "type": "debug", "z": "75c64f88.cfdf8", "name": "sent", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 870, "y": 1220, "wires": [] }, { "id": "11d1ee12369a56d7", "type": "change", "z": "75c64f88.cfdf8", "name": "", "rules": [ { "t": "set", "p": "humiditySent", "pt": "flow", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 680, "y": 1220, "wires": [ [ "396f53bff34dd64d" ] ] }, { "id": "7e75ef7be56f4779", "type": "switch", "z": "75c64f88.cfdf8", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "neq", "v": "", "vt": "prev" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 410, "y": 1220, "wires": [ [ "11d1ee12369a56d7", "f28d2f63466ed2b8" ] ] }, { "id": "b884c41f2fdabe27", "type": "inject", "z": "75c64f88.cfdf8", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "sent", "payloadType": "str", "x": 210, "y": 1220, "wires": [ [ "7e75ef7be56f4779" ] ] }, { "id": "f28d2f63466ed2b8", "type": "debug", "z": "75c64f88.cfdf8", "name": "switch", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 550, "y": 1160, "wires": [] }, { "id": "5a53d606eaa73dd0", "type": "group", "z": "75c64f88.cfdf8", "name": "", "style": { "stroke": "#6f2fa0", "fill": "#dbcbe7", "label": true }, "nodes": [ "d020de920165a364", "54e2dfb7678177e0", "d5c96516f6dcb063" ], "x": 204, "y": 1019, "w": 302, "h": 142 }, { "id": "d020de920165a364", "type": "ui_text", "z": "75c64f88.cfdf8", "g": "5a53d606eaa73dd0", "group": "d9012267.99b7a", "order": 3, "width": "0", "height": "0", "name": "", "label": "Amps AC", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 420, "y": 1120, "wires": [] }, { "id": "54e2dfb7678177e0", "type": "link in", "z": "75c64f88.cfdf8", "g": "5a53d606eaa73dd0", "name": "link in 5", "links": [ "b6da650956b2e085" ], "x": 245, "y": 1120, "wires": [ [ "d020de920165a364" ] ] }, { "id": "d5c96516f6dcb063", "type": "comment", "z": "75c64f88.cfdf8", "g": "5a53d606eaa73dd0", "name": "Show current ", "info": "", "x": 310, "y": 1060, "wires": [] }, { "id": "5165c872ea833f5a", "type": "zigbee2mqtt-server", "name": "", "host": "localhost", "mqtt_port": "1883", "mqtt_username": "", "mqtt_password": "", "mqtt_qos": "1", "tls": "47c99f2f.8b1c1", "usetls": false, "base_topic": "zigbee2mqtt" }, { "id": "d9012267.99b7a", "type": "ui_group", "name": "Room Temp", "tab": "423b79e9f37ac022", "order": 1, "disp": false, "width": "6", "collapse": false, "className": "" }, { "id": "47c99f2f.8b1c1", "type": "tls-config", "name": "TLS Gbridge", "cert": "", "key": "", "ca": "", "certname": "", "keyname": "", "caname": "", "servername": "mqtt.gbridge.io", "verifyservercert": true }, { "id": "423b79e9f37ac022", "type": "ui_tab", "name": "Room Temp", "icon": "dashboard", "order": 3, "disabled": false, "hidden": false } ]