From 09eaa68bc754c5b2557d59f22aff0e7697f435bc Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sun, 2 Jul 2023 19:33:50 -0400 Subject: [PATCH] Finally fix todoist issue --- flows.json | 99 +++++++++++++++++++++++++++++++------------------ flows_cred.json | 2 +- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/flows.json b/flows.json index 932e3fd..5b6fd5f 100644 --- a/flows.json +++ b/flows.json @@ -905,7 +905,9 @@ "f4bfbaca4d7fb1df" ], "x": 14, - "y": 39 + "y": 39, + "w": 792, + "h": 142 }, { "id": "50e4d951ee7b3e54", @@ -922,10 +924,12 @@ "788eb0a1551db9b8", "7674185d1e5ee489", "427cc2991454bbf0", - "3c03edd9c35f85f8" + "603140fef1e2edaf" ], "x": 14, - "y": 199 + "y": 199, + "w": 712, + "h": 142 }, { "id": "fbbe69a14cbe0236", @@ -1116,9 +1120,9 @@ "08a22fa71fce5e91", "d580c539c554a4c1", "f0cc7b3b9622312a", - "e9e8bc8b535c232f", "206e512c5268020f", - "4da18a3f1e0298db" + "4da18a3f1e0298db", + "283661388275a459" ], "x": 34, "y": 559, @@ -1145,7 +1149,9 @@ "f44427c5a493c428" ], "x": 14, - "y": 359 + "y": 359, + "w": 1012, + "h": 222 }, { "id": "eeafd13be593ae69", @@ -3601,6 +3607,11 @@ "resend": true, "debugEnabled": false }, + { + "id": "81cb9d95d14a3e5a", + "type": "add-todoist-api-token", + "name": "Tony" + }, { "id": "afead614fabc01bb", "type": "function", @@ -5537,7 +5548,9 @@ "x": 575, "y": 720, "wires": [ - [] + [ + "283661388275a459" + ] ], "l": false }, @@ -5911,7 +5924,9 @@ "x": 575, "y": 780, "wires": [ - [] + [ + "283661388275a459" + ] ], "l": false }, @@ -6350,7 +6365,9 @@ "x": 575, "y": 840, "wires": [ - [] + [ + "283661388275a459" + ] ], "l": false }, @@ -6377,21 +6394,12 @@ "x": 575, "y": 900, "wires": [ - [] + [ + "283661388275a459" + ] ], "l": false }, - { - "id": "e9e8bc8b535c232f", - "type": "comment", - "z": "4a8821853d4dd1ad", - "g": "1ca205a84922c8c2", - "name": "Complete a task", - "info": "", - "x": 740, - "y": 820, - "wires": [] - }, { "id": "9f6498380a05390b", "type": "switch", @@ -6762,6 +6770,19 @@ [] ] }, + { + "id": "283661388275a459", + "type": "todoist-task-complete", + "z": "4a8821853d4dd1ad", + "g": "1ca205a84922c8c2", + "name": "", + "token": "81cb9d95d14a3e5a", + "x": 740, + "y": 820, + "wires": [ + [] + ] + }, { "id": "fd4bbf481e16e6ea", "type": "sunrise", @@ -18377,7 +18398,7 @@ "z": "72f99805df043603", "g": "e065b1ed4938b477", "name": "Processing", - "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = global.get('mb_aircon_installed')\nvar topic = msg.topic\nvar vacation = states['input_boolean.vacation_mode'].state\nvar highTemp = states['sensor.todays_high_temp'].state\nvar dayThreshold = states['input_number.master_bedroom_daytime_threshold'].state\nvar dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\nvar bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\nvar showerMode = states['input_boolean.shower_mode'].state\nvar nightVolume = states['input_number.master_bedroom_echo_dot_night_volume'].state\nvar schedModeFan = states['input_select.scheduled_climate_mode_master_bedroom_fan'].state\n\nmsg.acInstalled = ac\nmsg.daytemp = dayTemp\nmsg.nighttemp = nightTemp\nmsg.bedtemp = bedTemp\nmsg.daythreshold = dayThreshold\nmsg.showermode = showerMode\nmsg.nightvolume = nightVolume\n\nif (vacation === 'off') {\n if (topic === 'mrbedroom-cooling') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Cooling Schedule\"});\n return[msg,null,null]\n } else if (topic === 'manual-night') {\n if (schedModeFan === 'Fan') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Manual Night (Fan)\"});\n return[msg,msg,null]\n } else {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Manual Night (No Fan)\"});\n return[msg,null,null]\n }\n } else if (topic === 'mrbedroom-fan' && schedModeFan == 'Fan') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Fan Schedule\"});\n return[null,msg,null]\n } else if (topic === 'mrbedroom-wakeup') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Wakeup Schedule\"});\n return[null,null,msg]\n } else if (topic === 'manual-day'){\n node.status({fill:\"blue\",shape:\"dot\",text:\"Manual Day\"});\n return[null,null,msg]\n }\n} else {\n return[null,null,null]\n}", + "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = global.get('mb_aircon_installed')\nvar topic = msg.topic\nvar vacation = states['input_boolean.vacation_mode'].state\nvar highTemp = states['sensor.today_corrected_high_temp'].state\nvar dayThreshold = states['input_number.master_bedroom_daytime_threshold'].state\nvar dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\nvar bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\nvar showerMode = states['input_boolean.shower_mode'].state\nvar nightVolume = states['input_number.master_bedroom_echo_dot_night_volume'].state\nvar schedModeFan = states['input_select.scheduled_climate_mode_master_bedroom_fan'].state\n\nmsg.acInstalled = ac\nmsg.daytemp = dayTemp\nmsg.nighttemp = nightTemp\nmsg.bedtemp = bedTemp\nmsg.daythreshold = dayThreshold\nmsg.showermode = showerMode\nmsg.nightvolume = nightVolume\n\nif (vacation === 'off') {\n if (topic === 'mrbedroom-cooling') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Cooling Schedule\"});\n return[msg,null,null]\n } else if (topic === 'manual-night') {\n if (schedModeFan === 'Fan') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Manual Night (Fan)\"});\n return[msg,msg,null]\n } else {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Manual Night (No Fan)\"});\n return[msg,null,null]\n }\n } else if (topic === 'mrbedroom-fan' && schedModeFan == 'Fan') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Fan Schedule\"});\n return[null,msg,null]\n } else if (topic === 'mrbedroom-wakeup') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Wakeup Schedule\"});\n return[null,null,msg]\n } else if (topic === 'manual-day'){\n node.status({fill:\"blue\",shape:\"dot\",text:\"Manual Day\"});\n return[null,null,msg]\n }\n} else {\n return[null,null,null]\n}", "outputs": 3, "noerr": 0, "initialize": "", @@ -18905,7 +18926,7 @@ "z": "72f99805df043603", "g": "e065b1ed4938b477", "name": "Hot Day?", - "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = global.get('mb_aircon_installed')\nvar highTemp = states['sensor.todays_high_temp'].state\nvar dayThreshold = states['input_number.master_bedroom_daytime_threshold'].state\nvar dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\n\nmsg.daytemp = dayTemp\nmsg.nighttemp = nightTemp\n\nif (ac === 'on') {\n if (highTemp > dayThreshold) {\n node.status({fill:\"green\",shape:\"dot\",text:\"Hot Day\"});\n return[msg,null,msg]\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Normal\"});\n return[null,msg,msg]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"No A/C\"});\n return[null,null,msg]\n}", + "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = global.get('mb_aircon_installed')\nvar highTemp = states['sensor.today_corrected_high_temp'].state\nvar dayThreshold = states['input_number.master_bedroom_daytime_threshold'].state\nvar dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\n\nmsg.daytemp = dayTemp\nmsg.nighttemp = nightTemp\n\nif (ac === 'on') {\n if (highTemp > dayThreshold) {\n node.status({fill:\"green\",shape:\"dot\",text:\"Hot Day\"});\n return[msg,null,msg]\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Normal\"});\n return[null,msg,msg]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"No A/C\"});\n return[null,null,msg]\n}", "outputs": 3, "noerr": 0, "initialize": "", @@ -23196,7 +23217,9 @@ "x": 460, "y": 240, "wires": [ - [] + [ + "603140fef1e2edaf" + ] ] }, { @@ -23205,7 +23228,7 @@ "z": "ee67610b4a0578d2", "g": "50e4d951ee7b3e54", "name": "Processing", - "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar text = states['input_text.report_system'].state\nvar type = states['input_select.report_type'].state\n\nmsg.text = text\n\nif (type === \"New Idea\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"New Idea\"});\n msg.type = \"81234669\"\n} else if (type === \"Bug Report\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"Bug Report\"});\n msg.type = \"94865633\"\n}\nreturn msg;", + "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar text = states['input_text.report_system'].state\nvar type = states['input_select.report_type'].state\n\nmsg.text = text\n\nif (type === \"New Idea\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"New Idea\"});\n msg.type = \"114199257\"\n} else if (type === \"Bug Report\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"Bug Report\"});\n msg.type = \"94865633\"\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", @@ -23557,17 +23580,6 @@ [] ] }, - { - "id": "3c03edd9c35f85f8", - "type": "comment", - "z": "ee67610b4a0578d2", - "g": "50e4d951ee7b3e54", - "name": "Create Task", - "info": "", - "x": 630, - "y": 240, - "wires": [] - }, { "id": "f4bfbaca4d7fb1df", "type": "function", @@ -23613,6 +23625,19 @@ ], "icon": "node-red-contrib-cpu/cpu.png" }, + { + "id": "603140fef1e2edaf", + "type": "todoist-task-create", + "z": "ee67610b4a0578d2", + "g": "50e4d951ee7b3e54", + "name": "", + "token": "81cb9d95d14a3e5a", + "x": 630, + "y": 240, + "wires": [ + [] + ] + }, { "id": "5d7c63526234945e", "type": "api-render-template", @@ -27943,7 +27968,7 @@ "type": "function", "z": "d49b385d8b582b20", "name": "Heat Threshold", - "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar hightemp = states['sensor.todays_high_temp'].state\nvar threshold = states['input_number.master_bedroom_daytime_threshold'].state\n\nif (hightemp >= threshold) {\n return [msg,null];\n} else {\n return [null,msg];\n}", + "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar hightemp = states['sensor.today_corrected_high_temp'].state\nvar threshold = states['input_number.master_bedroom_daytime_threshold'].state\n\nif (hightemp >= threshold) {\n return [msg,null];\n} else {\n return [null,msg];\n}", "outputs": 2, "noerr": 0, "initialize": "", diff --git a/flows_cred.json b/flows_cred.json index 012b4e8..ffa399c 100644 --- a/flows_cred.json +++ b/flows_cred.json @@ -1,3 +1,3 @@ { - "$": "63463f4937c5bbb0324d9642e7876367bNwSdWPMA7oJKPuVLcjdzu4px1PM+TWPA6BU4cKEGJLKJzKo4LkWGDd4uRKHH0WmwZS3WTh3rOJgCaXV98xVT/wuwHkBJfAxYsvtSSG2KGfEyuFOdF4KVw9J9r/r0qx00B5Rsy2WMpxwbf0SjiKCD5uH01oYnAKa02wsXlGAw7ctr7Qa4Cn/ImmAEBRapC4/wtrsqz4DuZgaMQJ1uk0LTk7FUBzhyPGJWDjYsDlEeupdhWJrdxBSkp6lEOsvRr/UX22CFF1eBpV6aHpFUydGtMjUl6J7G0lKaB+kqS0MBoAQoKPQ/0Hr/aU+jRI0Im2nJG12waVaUofK1Rw37W+zb281aWHQc2vSfJPU3181t7PPLtC7SbVWTEFnIAWN7Vs+G+2KLxL3jXUx+7r8klxL6pZOR1GFqa4y3Zwjqu86pydawZZTe+oSsMbyaS0ow0JTnK6PzZYrxtDC6bJ1kO0I1j4LX/sjsxP91U/Y2khU2uFB3JYfpqXcYOOY0EOb8ypsvy85b2kDYIHHQ33yPa1IKGjk0SQ=" + "$": "b54e816fabf95a68cd793c05df2aa2c1D1+rLItmU/1RSmz+JlbfqMTctTOTPNJc04k8Yh0Buq9SPwSbIzXvS1zMWLmTBZU0TnwMynqCj46WwLlGUL+puKhuKzC36tLGClflPrjZlBh8nHg6Y8w8Nth3ZSkEZIQfWcM5Yq3ZwrdLOflVHpkhsuH/giKPGDGOFf4IZUhsqbbpl3/jrUfpjNFpt7Od+LxqhaQ1iEZ2ArH3hiuYgj9F34otsz/7Lli3q9gmYOXAmIUea5C/MrfheQwYxMEi55ImPVkKdUpr7b+INbnZ5Go/UdaKqR/hidOHhh0RyExezTa/qvY7ZF9oUb+7gBmYi9T9WipKIrxUj41iIUPg+cGUWbTScMYxeyZFKnJhH/cjD8Zdr+Z9xG7PdyLS6kM3IDZCGepGWMJmqdL4Sk5ddpI4RDrRaEPsUgY/lf2XOW+XvGKXhzwAqUvtdZZHPIe/oUMpI+UvTGB3npV+9/7hB/jpy9iJtihJt9aYRa15lkXr4hH7eDCPVa6APM0uOyo63mNsKdT1hKnIbbGSc1f/98JCFGGCg0QKACTc/esvRf3qbcnN+CXB7m9SdN4OH0PlaN9twxzZpExxBgLfvtvcqvHqRec3KGVBgGh9S6WUkFZ5CpJbd+TBgG9HlQ9rDT4=" } \ No newline at end of file