Last active
March 12, 2020 23:43
-
-
Save MorningZ/9ef6391ffab4ecdf600be06a346430cc to your computer and use it in GitHub Desktop.
Hubitat Mode Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "5a0c9da9.b21974", | |
"type": "tab", | |
"label": "Hubitat", | |
"disabled": false, | |
"info": "" | |
}, | |
{ | |
"id": "b322a460.966118", | |
"type": "time-switch", | |
"z": "5a0c9da9.b21974", | |
"name": "Is Daytime", | |
"lat": "-81.298843", | |
"lon": "28.948790", | |
"startTime": "sunrise", | |
"endTime": "sunsetStart", | |
"startOffset": 0, | |
"endOffset": 0, | |
"x": 290, | |
"y": 100, | |
"wires": [ | |
[ | |
"3b0a6997.2ff6a6" | |
], | |
[ | |
"5f26855d.88034c" | |
] | |
] | |
}, | |
{ | |
"id": "5f26855d.88034c", | |
"type": "time-switch", | |
"z": "5a0c9da9.b21974", | |
"name": "Is Evening", | |
"lat": "28.948790", | |
"lon": "-81.298843", | |
"startTime": "sunsetStart", | |
"endTime": "14:15", | |
"startOffset": 0, | |
"endOffset": 0, | |
"x": 290, | |
"y": 160, | |
"wires": [ | |
[ | |
"26f52429.9f542c" | |
], | |
[ | |
"a1508ef7.66a38" | |
] | |
] | |
}, | |
{ | |
"id": "a1508ef7.66a38", | |
"type": "time-switch", | |
"z": "5a0c9da9.b21974", | |
"name": "Is Night", | |
"lat": "28.948790", | |
"lon": "-81.298843", | |
"startTime": "14:15", | |
"endTime": "sunrise", | |
"startOffset": 0, | |
"endOffset": 0, | |
"x": 280, | |
"y": 220, | |
"wires": [ | |
[ | |
"1090517a.7e209f" | |
], | |
[] | |
] | |
}, | |
{ | |
"id": "4aea24ec.c6f89c", | |
"type": "inject", | |
"z": "5a0c9da9.b21974", | |
"name": "Check Time", | |
"topic": "", | |
"payload": "", | |
"payloadType": "date", | |
"repeat": "180", | |
"crontab": "", | |
"once": true, | |
"onceDelay": "3", | |
"x": 130, | |
"y": 40, | |
"wires": [ | |
[ | |
"a6f1015e.d644a" | |
] | |
] | |
}, | |
{ | |
"id": "3b0a6997.2ff6a6", | |
"type": "change", | |
"z": "5a0c9da9.b21974", | |
"name": "Set to Day", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "current", | |
"pt": "msg", | |
"to": "payload.value", | |
"tot": "msg" | |
}, | |
{ | |
"t": "set", | |
"p": "alexa", | |
"pt": "msg", | |
"to": "Set mode to Daytime", | |
"tot": "str" | |
}, | |
{ | |
"t": "set", | |
"p": "url", | |
"pt": "msg", | |
"to": "http://192.168.0.10/apps/api/maker_api_app_id/modes/1?access_token=maker_api_app_token", | |
"tot": "str" | |
}, | |
{ | |
"t": "set", | |
"p": "name", | |
"pt": "msg", | |
"to": "Day", | |
"tot": "str" | |
}, | |
{ | |
"t": "set", | |
"p": "id", | |
"pt": "msg", | |
"to": "1", | |
"tot": "str" | |
}, | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "{}", | |
"tot": "json" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 415, | |
"y": 99, | |
"wires": [ | |
[ | |
"a4850ea7.422b5" | |
] | |
], | |
"l": false | |
}, | |
{ | |
"id": "26f52429.9f542c", | |
"type": "change", | |
"z": "5a0c9da9.b21974", | |
"name": "Set to Evening", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "{\"mode\":\"Evening\",\"value\":2}", | |
"tot": "json" | |
}, | |
{ | |
"t": "set", | |
"p": "alexa", | |
"pt": "msg", | |
"to": "Set mode to Evening", | |
"tot": "str" | |
}, | |
{ | |
"t": "set", | |
"p": "url", | |
"pt": "msg", | |
"to": "http://192.168.0.10/apps/api/maker_api_app_id/modes/2?access_token=maker_api_app_token", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 415, | |
"y": 160, | |
"wires": [ | |
[ | |
"a4850ea7.422b5" | |
] | |
], | |
"l": false | |
}, | |
{ | |
"id": "1090517a.7e209f", | |
"type": "change", | |
"z": "5a0c9da9.b21974", | |
"name": "Set to Night", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "{\"mode\":\"Night\",\"value\":3}", | |
"tot": "json" | |
}, | |
{ | |
"t": "set", | |
"p": "alexa", | |
"pt": "msg", | |
"to": "Set to mode to Night", | |
"tot": "str" | |
}, | |
{ | |
"t": "set", | |
"p": "url", | |
"pt": "msg", | |
"to": "http://192.168.0.10/apps/api/maker_api_app_id/modes/3?access_token=maker_api_app_token", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 415, | |
"y": 220, | |
"wires": [ | |
[ | |
"a4850ea7.422b5" | |
] | |
], | |
"l": false | |
}, | |
{ | |
"id": "a32792a9.6219c", | |
"type": "http request", | |
"z": "5a0c9da9.b21974", | |
"name": "Change Mode", | |
"method": "GET", | |
"ret": "txt", | |
"paytoqs": true, | |
"url": "", | |
"tls": "", | |
"persist": false, | |
"proxy": "", | |
"authType": "", | |
"x": 700, | |
"y": 140, | |
"wires": [ | |
[ | |
"48d0c2e4.7a069c" | |
] | |
], | |
"info": "Call Hubitat Maker API to change the mode" | |
}, | |
{ | |
"id": "fe953b20.68e9b8", | |
"type": "hubitat mode", | |
"z": "5a0c9da9.b21974", | |
"name": "Current Mode", | |
"server": "bcc58271.76572", | |
"sendEvent": false, | |
"x": 155, | |
"y": 100, | |
"wires": [ | |
[ | |
"b322a460.966118" | |
] | |
], | |
"inputLabels": [ | |
"Timestamp" | |
], | |
"outputLabels": [ | |
"Hubitat mode" | |
], | |
"l": false | |
}, | |
{ | |
"id": "48d0c2e4.7a069c", | |
"type": "debug", | |
"z": "5a0c9da9.b21974", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"x": 555, | |
"y": 40, | |
"wires": [], | |
"l": false | |
}, | |
{ | |
"id": "a6f1015e.d644a", | |
"type": "change", | |
"z": "5a0c9da9.b21974", | |
"name": "Save Timestamp", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "ts", | |
"pt": "msg", | |
"to": "payload", | |
"tot": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 95, | |
"y": 100, | |
"wires": [ | |
[ | |
"fe953b20.68e9b8" | |
] | |
], | |
"l": false | |
}, | |
{ | |
"id": "c0ace75c.d95468", | |
"type": "alexa-remote-routine", | |
"z": "5a0c9da9.b21974", | |
"name": "Tell me mode change", | |
"account": "2c94349.0cd1dcc", | |
"routineNode": { | |
"type": "speakAtVolume", | |
"payload": { | |
"type": "regular", | |
"text": { | |
"type": "msg", | |
"value": "alexa" | |
}, | |
"volume": { | |
"type": "num", | |
"value": "60" | |
}, | |
"mode": "set", | |
"devices": [ | |
"G0918309002202U4" | |
] | |
} | |
}, | |
"x": 635, | |
"y": 180, | |
"wires": [ | |
[] | |
], | |
"l": false | |
}, | |
{ | |
"id": "7c34ddcf.0131b4", | |
"type": "comment", | |
"z": "5a0c9da9.b21974", | |
"name": "Change Mode by Timestamp", | |
"info": "", | |
"x": 360, | |
"y": 40, | |
"wires": [] | |
}, | |
{ | |
"id": "a4850ea7.422b5", | |
"type": "rbe", | |
"z": "5a0c9da9.b21974", | |
"name": "Make sure the mode changed", | |
"func": "rbe", | |
"gap": "", | |
"start": "", | |
"inout": "out", | |
"property": "url", | |
"x": 535, | |
"y": 160, | |
"wires": [ | |
[ | |
"a32792a9.6219c", | |
"c0ace75c.d95468" | |
] | |
], | |
"l": false | |
}, | |
{ | |
"id": "bcc58271.76572", | |
"type": "hubitat config", | |
"z": "", | |
"name": "Hubitat Elevation", | |
"usetls": false, | |
"host": "192.168.0.10", | |
"port": "80", | |
"token": "maker_api_app_token", | |
"appId": "maker_api_app_id", | |
"nodeRedServer": "http://192.168.0.10:1880/", | |
"webhookPath": "/hubitat/webhook" | |
}, | |
{ | |
"id": "2c94349.0cd1dcc", | |
"type": "alexa-remote-account", | |
"z": "", | |
"name": "", | |
"authMethod": "proxy", | |
"proxyOwnIp": "localhost", | |
"proxyPort": "3456", | |
"cookieFile": "authFile", | |
"refreshInterval": "3", | |
"alexaServiceHost": "pitangui.amazon.com", | |
"amazonPage": "amazon.com", | |
"acceptLanguage": "en-US", | |
"userAgent": "", | |
"useWsMqtt": "on", | |
"autoInit": "on" | |
} | |
] |
To find out the IDs of your modes, run this in your browser, replace accordingly in the flow
http://192.168.0.10/apps/api/maker_api_app_id/modes?access_token=maker_api_app_token
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Palettes needed:
node-red-node-timeswitch
node-red-contrib-alexa-remote2 (or just delete that node on the flow)
Replace:
192.168.0.11 -> with your Node-RED host IP address
192.168.0.10 -> with your Hubitat host IP address
maker_api_app_id -> the numeric identifier of the Hubitat Maker API application
maker_api_app_token -> your Maker API access token