Skip to content

Instantly share code, notes, and snippets.

@rradillen
Created January 2, 2019 14:29
Show Gist options
  • Save rradillen/e82ee42baa1d4bba93e48082612b8345 to your computer and use it in GitHub Desktop.
Save rradillen/e82ee42baa1d4bba93e48082612b8345 to your computer and use it in GitHub Desktop.
[
{
"disabled": false,
"id": "3b0a0d3f.f34de2",
"info": "",
"label": "Announce shelly h&t",
"type": "tab"
},
{
"broker": "aeafd68e.b67c08",
"id": "4492857.791157c",
"name": "Announce",
"qos": "1",
"topic": "shellies/announce",
"type": "mqtt in",
"wires": [
[
"b1693bd0.656848",
"8c31ef81.869cb"
]
],
"x": 80,
"y": 140,
"z": "3b0a0d3f.f34de2"
},
{
"func": "\nreturn {payload:msg.payload.id};",
"id": "c258c979.b225c8",
"name": "extractid",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"d830ebce.9933a8"
]
],
"x": 260,
"y": 200,
"z": "3b0a0d3f.f34de2"
},
{
"func": "var topic=\"homeassistant/sensor/\"+msg.payload+\"_temp/config\";\nvar payload={\n state_topic:\"shellies/\"+msg.payload+\"/sensor/temperature\",\n device_class:\"temperature\",\n unit_of_measurement:\"°C\",\n name: \"Temp \"+msg.payload\n}\nreturn {topic:topic,payload:payload};",
"id": "f7be61c9.e3361",
"name": "T",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"c1437b1d.ddefd8"
]
],
"x": 570,
"y": 120,
"z": "3b0a0d3f.f34de2"
},
{
"func": "var topic=\"homeassistant/sensor/\"+msg.payload+\"_hum/config\";\nvar payload={\n state_topic:\"shellies/\"+msg.payload+\"/sensor/humidity\",\n device_class:\"humidity\",\n unit_of_measurement:\"%\",\n name: \"Humidity \"+msg.payload\n}\nreturn {topic:topic,payload:payload};",
"id": "6eacb11.87a6d5",
"name": "Hum",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"c1437b1d.ddefd8"
]
],
"x": 570,
"y": 160,
"z": "3b0a0d3f.f34de2"
},
{
"func": "\nvar topic=\"homeassistant/sensor/\"+msg.payload+\"_batt/config\";\nvar payload={\n state_topic:\"shellies/\"+msg.payload+\"/sensor/battery\",\n device_class:\"battery\",\n unit_of_measurement:\"%\",\n name: \"Battery \"+msg.payload\n}\nreturn {topic:topic,payload:payload};",
"id": "22225e9d.0c30a2",
"name": "Batt",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"c1437b1d.ddefd8"
]
],
"x": 570,
"y": 200,
"z": "3b0a0d3f.f34de2"
},
{
"broker": "aeafd68e.b67c08",
"id": "c1437b1d.ddefd8",
"name": "",
"qos": "1",
"retain": "true",
"topic": "",
"type": "mqtt out",
"wires": [],
"x": 780,
"y": 160,
"z": "3b0a0d3f.f34de2"
},
{
"action": "",
"id": "b1693bd0.656848",
"name": "",
"pretty": false,
"property": "payload",
"type": "json",
"wires": [
[
"c258c979.b225c8"
]
],
"x": 250,
"y": 120,
"z": "3b0a0d3f.f34de2"
},
{
"broker": "aeafd68e.b67c08",
"id": "2e56d7eb.186438",
"name": "",
"qos": "1",
"retain": "true",
"topic": "shellies/announce",
"type": "mqtt out",
"wires": [],
"x": 250,
"y": 280,
"z": "3b0a0d3f.f34de2"
},
{
"func": "rbe",
"gap": "",
"id": "8c31ef81.869cb",
"inout": "out",
"name": "",
"property": "payload",
"start": "",
"type": "rbe",
"wires": [
[
"2e56d7eb.186438"
]
],
"x": 110,
"y": 240,
"z": "3b0a0d3f.f34de2"
},
{
"checkall": "true",
"id": "d830ebce.9933a8",
"name": "Filter h/t",
"outputs": 1,
"property": "payload",
"propertyType": "msg",
"repair": false,
"rules": [
{
"t": "cont",
"v": "ht",
"vt": "str"
}
],
"type": "switch",
"wires": [
[
"f7be61c9.e3361",
"6eacb11.87a6d5",
"22225e9d.0c30a2"
]
],
"x": 420,
"y": 160,
"z": "3b0a0d3f.f34de2"
},
{
"birthPayload": "",
"birthQos": "0",
"birthTopic": "",
"broker": "<mqtt-url>",
"cleansession": true,
"clientid": "",
"closePayload": "",
"closeQos": "0",
"closeTopic": "",
"compatmode": false,
"id": "aeafd68e.b67c08",
"keepalive": "60",
"name": "MQTT",
"port": "1883",
"type": "mqtt-broker",
"usetls": false,
"willPayload": "",
"willQos": "0",
"willTopic": "",
"z": ""
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment