Skip to content

Instantly share code, notes, and snippets.

@jordanrounds
Created August 17, 2020 20:35
Show Gist options
  • Save jordanrounds/586268908aa687929a8b0f789b64cf74 to your computer and use it in GitHub Desktop.
Save jordanrounds/586268908aa687929a8b0f789b64cf74 to your computer and use it in GitHub Desktop.
[
{
"id": "3d8df394.6c6d3c",
"type": "mqtt in",
"z": "be5d7e99.087c9",
"name": "",
"topic": "insteon/+/state",
"qos": "0",
"datatype": "json",
"broker": "f619c574.7242d8",
"x": 220,
"y": 1020,
"wires": [
[
"4ab6b9e9.1c6db8"
]
]
},
{
"id": "fe8eced6.3b90e",
"type": "api-call-service",
"z": "be5d7e99.087c9",
"name": "Set Brightness",
"server": "2ef1a1b8.4b157e",
"version": 1,
"debugenabled": false,
"service_domain": "light",
"service": "turn_on",
"entityId": "{{payload.entity_id}}",
"data": "{ \"brightness\": {{brightness}} }",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 840,
"y": 1020,
"wires": [
[]
],
"icon": "font-awesome/fa-lightbulb-o"
},
{
"id": "a897e411.b26bf8",
"type": "ha-get-entities",
"z": "be5d7e99.087c9",
"server": "2ef1a1b8.4b157e",
"name": "Light",
"rules": [
{
"property": "entity_id",
"logic": "is",
"value": "dimmer.attributes.sync_entity_id",
"valueType": "msg"
}
],
"output_type": "split",
"output_empty_results": false,
"output_location_type": "msg",
"output_location": "lights",
"output_results_count": 1,
"x": 690,
"y": 1020,
"wires": [
[
"fe8eced6.3b90e"
]
],
"icon": "font-awesome/fa-search",
"info": "Find the Light that is synced to this dimmer's address."
},
{
"id": "4ab6b9e9.1c6db8",
"type": "ha-get-entities",
"z": "be5d7e99.087c9",
"server": "2ef1a1b8.4b157e",
"name": "Dimmer",
"rules": [
{
"property": "attributes.address",
"logic": "is",
"value": "payload.address",
"valueType": "msg"
}
],
"output_type": "array",
"output_empty_results": false,
"output_location_type": "msg",
"output_location": "dimmers",
"output_results_count": 1,
"x": 400,
"y": 1020,
"wires": [
[
"116bc6d8.daed69"
]
],
"icon": "font-awesome/fa-search",
"info": "Finds the dimmer using the address from the mqtt payload as long as its state is on. The allows for responding to a press of the switch if its not already at 100%."
},
{
"id": "6f164eab.e6208",
"type": "inject",
"z": "be5d7e99.087c9",
"name": "ON 255",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{ \"state\" : \"ON\", \"brightness\" : 255, \"reason\" : \"device\", \"mode\" : \"normal\", \"address\" : \"41.b8.f6\" }",
"payloadType": "json",
"x": 250,
"y": 960,
"wires": [
[
"4ab6b9e9.1c6db8"
]
]
},
{
"id": "116bc6d8.daed69",
"type": "function",
"z": "be5d7e99.087c9",
"name": "Manual Tap",
"func": "let payload = msg.payload;\n\nmsg.dimmer = msg.dimmers[0];\ndelete msg.dimmers;\n\nlet device_on = payload.reason == \"device\" && payload.state == \"ON\";\nlet device_off = payload.reason == \"device\" && payload.state == \"OFF\";\nlet fast = payload.mode == \"fast\";\n\nlet fast_on = msg.dimmer.state == \"off\" && device_on && fast;\nlet fast_off = msg.dimmer.state == \"on\" && device_off && fast;\n\nlet fast_on_from_on = msg.dimmer.state == \"on\" && device_on && fast;\nlet fast_off_from_off = msg.dimmer.state == \"off\" && device_off && fast\n\nlet on_from_on = msg.dimmer.state == \"on\" && device_on\n\nif(fast_on || on_from_on) {\n msg.brightness = payload.brightness;\n return msg;\n}\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 550,
"y": 1020,
"wires": [
[
"a897e411.b26bf8"
]
],
"icon": "font-awesome/fa-question-circle",
"info": "`fast_on` and `fast_off` assume the dimmer was in the opposite state\n\n`fast_on_from_on` and `fast_off_from_off` could be used as extra commands, cycle through light colors, other automations, etc.\n\nOnly `fast_on`, and `on_from_on` have been handled."
},
{
"id": "79ec6ae4.579e34",
"type": "inject",
"z": "be5d7e99.087c9",
"name": "FAST ON",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{ \"state\" : \"ON\", \"brightness\" : 255, \"reason\" : \"device\", \"mode\" : \"fast\", \"address\" : \"41.b3.5e\" }",
"payloadType": "json",
"x": 240,
"y": 920,
"wires": [
[
"4ab6b9e9.1c6db8"
]
]
},
{
"id": "ceb96b8a.32a488",
"type": "inject",
"z": "be5d7e99.087c9",
"name": "FAST OFF",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{ \"state\" : \"OFF\", \"brightness\" : 0, \"reason\" : \"device\", \"mode\" : \"fast\", \"address\" : \"41.ad.4f\" }",
"payloadType": "json",
"x": 240,
"y": 880,
"wires": [
[]
]
},
{
"id": "f619c574.7242d8",
"type": "mqtt-broker",
"z": "",
"name": "NUC",
"broker": "192.168.7.234",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "2ef1a1b8.4b157e",
"type": "server",
"z": "",
"name": "Rounds House",
"legacy": false,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment