Skip to content

Instantly share code, notes, and snippets.

@jordanrounds
Created August 17, 2020 18:45
Show Gist options
  • Save jordanrounds/446311d0be02df6507f4a4766e3bb599 to your computer and use it in GitHub Desktop.
Save jordanrounds/446311d0be02df6507f4a4766e3bb599 to your computer and use it in GitHub Desktop.
Node Red - Dimmer Flow
[
{
"id": "e49ef50c.13e7a8",
"type": "server-state-changed",
"z": "be5d7e99.087c9",
"name": "Dimmer",
"server": "2ef1a1b8.4b157e",
"version": 1,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "light.dimmer",
"entityidfiltertype": "substring",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": true,
"x": 201,
"y": 1449,
"wires": [
[
"2556d986.9ca816"
]
]
},
{
"id": "7222b439.77935c",
"type": "switch",
"z": "be5d7e99.087c9",
"name": "On/Off",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 581,
"y": 1449,
"wires": [
[
"c40ccd86.1040c"
],
[
"5c227774.6b06e8"
]
],
"outputLabels": [
"On",
"Off"
],
"icon": "font-awesome/fa-question-circle"
},
{
"id": "5c227774.6b06e8",
"type": "api-call-service",
"z": "be5d7e99.087c9",
"name": "Light Off",
"server": "2ef1a1b8.4b157e",
"version": 1,
"debugenabled": false,
"service_domain": "light",
"service": "turn_off",
"entityId": "{{data.new_state.attributes.sync_entity_id}}",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 731,
"y": 1489,
"wires": [
[]
],
"icon": "font-awesome/fa-toggle-off"
},
{
"id": "4805c60.ac8da3c",
"type": "api-call-service",
"z": "be5d7e99.087c9",
"name": "Light On",
"server": "2ef1a1b8.4b157e",
"version": 1,
"debugenabled": false,
"service_domain": "light",
"service": "turn_on",
"entityId": "{{data.new_state.attributes.sync_entity_id}}",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 880,
"y": 1440,
"wires": [
[]
],
"icon": "font-awesome/fa-toggle-on"
},
{
"id": "ee309b59.d0b0c8",
"type": "function",
"z": "be5d7e99.087c9",
"name": "Stop",
"func": "let attrs = msg.data.new_state.attributes;\nlet hasManual = attrs.hasOwnProperty(\"manual_state\");\n\nif(!hasManual || hasManual && attrs.manual_state == \"STOP\") {\n return msg;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 461,
"y": 1449,
"wires": [
[
"7222b439.77935c"
]
],
"outputLabels": [
"Not Manual"
],
"icon": "font-awesome/fa-question-circle"
},
{
"id": "2556d986.9ca816",
"type": "switch",
"z": "be5d7e99.087c9",
"name": "Dimmer",
"property": "data.new_state.attributes.is_sync_dimmer",
"propertyType": "msg",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 331,
"y": 1449,
"wires": [
[
"ee309b59.d0b0c8"
]
],
"icon": "font-awesome/fa-exchange"
},
{
"id": "c40ccd86.1040c",
"type": "api-current-state",
"z": "be5d7e99.087c9",
"name": "Light Off?",
"server": "2ef1a1b8.4b157e",
"version": 1,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "{{data.new_state.attributes.sync_entity_id}}",
"state_type": "str",
"state_location": "",
"override_payload": "none",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 731,
"y": 1387,
"wires": [
[
"4805c60.ac8da3c"
],
[]
]
},
{
"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