Skip to content

Instantly share code, notes, and snippets.

@sktaylortrash
Created April 29, 2019 04:48
Show Gist options
  • Save sktaylortrash/75d010249e5a94123804e8921d95f77d to your computer and use it in GitHub Desktop.
Save sktaylortrash/75d010249e5a94123804e8921d95f77d to your computer and use it in GitHub Desktop.
[
{
"id": "f4346c37.d2e6e",
"type": "switch",
"z": "bfbd5fb1.3cd19",
"name": "On/Off or Dim",
"property": "on_off_command",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 420,
"y": 2240,
"wires": [
[
"dbbb9f8.388ca6"
],
[
"ffa7fbaf.549f38"
]
]
},
{
"id": "ffa7fbaf.549f38",
"type": "function",
"z": "bfbd5fb1.3cd19",
"name": "Set Bright",
"func": "msg.payload = msg.bri\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 600,
"y": 2280,
"wires": [
[
"1df3a152.70f37f"
]
]
},
{
"id": "dbbb9f8.388ca6",
"type": "switch",
"z": "bfbd5fb1.3cd19",
"name": "on/off",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 590,
"y": 2220,
"wires": [
[
"e6e757ac.b07e88"
],
[
"3742b0fa.0f471"
]
]
},
{
"id": "2f6b0bb7.b53794",
"type": "http request",
"z": "bfbd5fb1.3cd19",
"name": "",
"method": "PUT",
"ret": "obj",
"url": "http://deconz.local/api/01234567abc36/lights/1/state",
"tls": "",
"x": 1130,
"y": 2240,
"wires": [
[]
]
},
{
"id": "e6e757ac.b07e88",
"type": "change",
"z": "bfbd5fb1.3cd19",
"name": "On",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"on\":true}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 2200,
"wires": [
[
"2f6b0bb7.b53794"
]
]
},
{
"id": "3742b0fa.0f471",
"type": "change",
"z": "bfbd5fb1.3cd19",
"name": "Off",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"on\":false}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 2240,
"wires": [
[
"2f6b0bb7.b53794"
]
]
},
{
"id": "1df3a152.70f37f",
"type": "range",
"z": "bfbd5fb1.3cd19",
"minin": "1",
"maxin": "100",
"minout": "1",
"maxout": "254",
"action": "scale",
"round": true,
"property": "payload",
"name": "",
"x": 760,
"y": 2280,
"wires": [
[
"ef74724.ae13d9"
]
]
},
{
"id": "ef74724.ae13d9",
"type": "change",
"z": "bfbd5fb1.3cd19",
"name": "Bright",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\t \"bri\": msg.payload,\t \"transitiontime\": 1\t\t}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 910,
"y": 2280,
"wires": [
[
"2f6b0bb7.b53794"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment