Abfragen:
Falls man nur den Stream abfragen möchte ist es wichtig zu wissen dass der Kanal 1mal initialisiert werden muss!
Also am besten den Status abfragen mit {"id":1, "src":"user_1", "method":"Sys.GetStatus"}
Danach ist der Kanal offen und sendet. Für einen eventuellen Serverstart mach ich die Abfrage jede Minute.
ID0 schalten per Websocket:
ON
{"id":0, "src":"user_1", "method":"Switch.Set", "params":{"id":0, "on":true}}
OFF
{"id":0, "src":"user_1", "method":"Switch.Set", "params":{"id":0, "on":false}}
Stream per UDP schicken lassen (MQTT geht natürlich auch):
Anbei der Flow - IP und ID natürlich anpassen!
Code
[
{
"id": "8d46657e.c1fac8",
"type": "mqtt in",
"z": "c17e9ac0.ef4848",
"name": "shellypro4pm-84cca87e3824/events/rpc",
"topic": "shellypro4pm-84cca87e3824/events/rpc",
"qos": "2",
"datatype": "auto",
"broker": "931aeb2c.d93418",
"x": 1630,
"y": 660,
"wires": [
[]
]
},
{
"id": "1e46367d.16374a",
"type": "debug",
"z": "c17e9ac0.ef4848",
"name": "ShellyPro4PM",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 1960,
"y": 760,
"wires": []
},
{
"id": "4119869.115df78",
"type": "inject",
"z": "c17e9ac0.ef4848",
"name": "ON",
"topic": "",
"payload": "{\"id\":0, \"src\":\"user_1\", \"method\":\"Switch.Set\", \"params\":{\"id\":0, \"on\":true}}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1550,
"y": 900,
"wires": [
[
"9c72bf6b.c15b4"
]
]
},
{
"id": "49cbd42c.c1563c",
"type": "udp out",
"z": "c17e9ac0.ef4848",
"name": "",
"addr": "10.0.0.20",
"iface": "",
"port": "9888",
"ipv": "udp4",
"outport": "",
"base64": false,
"multicast": "false",
"x": 1950,
"y": 660,
"wires": []
},
{
"id": "bd64d06c.e758f",
"type": "websocket in",
"z": "c17e9ac0.ef4848",
"name": "",
"server": "",
"client": "7ddad5f7.fc5cec",
"x": 1580,
"y": 760,
"wires": [
[
"ef6a6dbe.369dc",
"49cbd42c.c1563c"
]
]
},
{
"id": "9c72bf6b.c15b4",
"type": "websocket out",
"z": "c17e9ac0.ef4848",
"name": "",
"server": "",
"client": "7ddad5f7.fc5cec",
"x": 1950,
"y": 900,
"wires": []
},
{
"id": "ef6a6dbe.369dc",
"type": "json",
"z": "c17e9ac0.ef4848",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1790,
"y": 760,
"wires": [
[
"1e46367d.16374a"
]
]
},
{
"id": "9df7ff52.1293b",
"type": "inject",
"z": "c17e9ac0.ef4848",
"name": "OFF",
"topic": "",
"payload": "{\"id\":0, \"src\":\"user_1\", \"method\":\"Switch.Set\", \"params\":{\"id\":0, \"on\":false}}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1550,
"y": 960,
"wires": [
[
"9c72bf6b.c15b4"
]
]
},
{
"id": "c74896e7.ff4618",
"type": "inject",
"z": "c17e9ac0.ef4848",
"name": "",
"topic": "",
"payload": "{\"id\":1, \"src\":\"user_1\", \"method\":\"Sys.GetStatus\"}",
"payloadType": "json",
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1570,
"y": 840,
"wires": [
[
"9c72bf6b.c15b4"
]
]
},
{
"id": "931aeb2c.d93418",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "10.0.0.45",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "7ddad5f7.fc5cec",
"type": "websocket-client",
"z": "",
"path": "ws://10.0.0.240/rpc",
"tls": "",
"wholemsg": "false"
}
]
Alles anzeigen
Der Shot ist als Flow (.txt) im Anhang