Ein bisschen Senf von mir:
Das JSON-RPC Protokoll definiert nur das Layout von Nachrichten, aber nicht den Transportmechanismus. Shellies können JSON-RPC Nachrichten offenbar über HTTP, UDP, MQTT, WebSocket und Bluetooth empfangen.
Die Diskussion hat mich neugierig gemacht, weil ich mich bisher nie gefragt habe, wie mein HA eigentlich mit dem Shelly kommuniziert. Des Rätsels Lösung ist: WebSocket. Die Dokumentation sagt Folgendes:
ZitatWebsocket
The connection is kept alive through the whole duration of the communication (not only for one request-response pair) as used by the local web interface and aioshelly. Each Shelly device has a websocket endpoint and a client can connect to it to communicate with the device. Protection through digest authentication is supported over this channel.
The websocket channel is served on ws://<shelly.addr>/rpc. Clients must send at least one request frame with valid src to be able to receive notifications from the device.
Das erwähnte aioshelly ist die Python Library, die für die HA-Shelly Kommunikation zuständig ist (und auch auf GitHub zu finden). Wenn ich via HA den Switch des Shelly betätige, erscheint im Shelly Log auch eine entsprechende Nachricht mit WS_in als Quelle:
HA hält also via WebSocket eine permanente Verbindung zum Shelly offen und ich würde annehmen, dass das wohl die effizienteste/performanteste Lösung ist...