openLuup: Shelly Bridge plugin
-
Has anyone got a Shelly Plus Uni yet...?
...and done anything with it??I've just acquired a couple of them, and pleased to say that they're immediately recognised by the latest Shelly bridge in openLuup.
What's a bit missing from the Shelly site, AFAIK, is any decent instructions about device configuration. I'm planning to use these as pulse counters for utility meters (which Shelly do advertise as an application.)
-
Has anyone got a Shelly Plus Uni yet...?
...and done anything with it??I've just acquired a couple of them, and pleased to say that they're immediately recognised by the latest Shelly bridge in openLuup.
What's a bit missing from the Shelly site, AFAIK, is any decent instructions about device configuration. I'm planning to use these as pulse counters for utility meters (which Shelly do advertise as an application.)
-
No - I don't have one at this time but I'll order one up, as I would very much like to make use of one. The Remote Procedure Calls (RPC) seems to be the new direction. On the H&T device, you have to enable some of the older topics (via a checkbox) to get it to work with the plugin.
I've been battling with Z-Wave JS of late. Looks like the ZWay plugin could be a good basis for communicating with that. ie swapping the http rx/tx over to MQTT. Sounds simple - right!!
-
No - I don't have one at this time but I'll order one up, as I would very much like to make use of one. The Remote Procedure Calls (RPC) seems to be the new direction. On the H&T device, you have to enable some of the older topics (via a checkbox) to get it to work with the plugin.
I've been battling with Z-Wave JS of late. Looks like the ZWay plugin could be a good basis for communicating with that. ie swapping the http rx/tx over to MQTT. Sounds simple - right!!
OK - updates have been made to the Shelley plugin. All is still working OK here.
On the Shelly H&T device: AltUI shows (under unknown circumstances) in the UI of the parent device: Line 1 and line 2 show the temperature and humidity - that's good. However, at later times, it shows Line 1 and line 2 as the humidity and blank. Not sure if AltUi or openLuup is the issue.
I now have a "Shelly Pro 3em". If you are interested in integrating it, let me know how I help. I see at the other place, they are still having problems with this one!
-
OK - updates have been made to the Shelley plugin. All is still working OK here.
On the Shelly H&T device: AltUI shows (under unknown circumstances) in the UI of the parent device: Line 1 and line 2 show the temperature and humidity - that's good. However, at later times, it shows Line 1 and line 2 as the humidity and blank. Not sure if AltUi or openLuup is the issue.
I now have a "Shelly Pro 3em". If you are interested in integrating it, let me know how I help. I see at the other place, they are still having problems with this one!
@a-lurker said in openLuup: Shelly Bridge plugin:
On the Shelly H&T device: AltUI shows (under unknown circumstances) in the UI of the parent device: Line 1 and line 2 show the temperature and humidity - that's good. However, at later times, it shows Line 1 and line 2 as the humidity and blank. Not sure if AltUi or openLuup is the issue.
Yes, I know this one. If a device has a standard Temperature or Humidity variable, then AltUI will display the value on the panel. Unfortunately, if it has both, then only the humidity is shown after the first update.
-
Had a quick look at the Shelly pro 3em. Looks like it gets ignored at line 643:
if not shelly: match "^shellyplus" then return end ...
The H&T device publishes: "shellyplusht-MAC_address". However the Shelly pro 3em publishes: "shellypro3em-MAC_address". So no "plus" found. And the user can change this label in the device's web page under "MQTT prefix". I changed the prefix so it included "plus" but that didn't seem to help. EDIT: it did help - I had just plugged the "plus" in the wrong spot. See post further below.
On the shelly-gen2-cmd/rpc topic I only see the H&T device - not the shellypro3em.
I don't have a Gen 1 device, so I can't see what would identify one from the other. Could have a numeric value associated with each known device indicating its generation. Also the RPC communication seems to be purely Gen 2?
-
My strong recommendation is not to change the default device MQTT prefix. It would just make setting up each device a total hassle. I've gone with defaults wherever possible, the only mandatory chamge being the IP address of openLuup's MQTT server.
I hadn't appreciated that the Pro devices don't identify as "shellyplus" and I can fix that.
-
Shelly firmware has changed considerably since the early versions. I should probably revisit the Gen 1 handling and make it more generic.
"not to change the default device MQTT prefix". I always leave things at default if possible. This was just for test purposes. Below is the resulting log of the device being created with a few edits. Note that "shellypro3em" was temporarily replaced with "shellypluspro3em" in order to get some action:
2024-03-28 13:09:35.516 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x558f264ee8 2024-03-28 13:09:35.546 openLuup.mqtt:: shellypluspro3em-MAC_address_redacted UNSUBSCRIBE from ALL tcp{client}: 0x558f264ee8 2024-03-28 13:09:38.357 openLuup.io.server:: MQTT:1883 connection from Shelly_IP_redacted tcp{client}: 0x5590804a28 2024-03-28 13:09:38.392 openLuup.mqtt:: shellypro3em-MAC_address_redacted SUBSCRIBE to shellypluspro3em-MAC_address_redacted/rpc tcp{client}: 0x5590804a28 2024-03-28 13:09:38.410 openLuup.mqtt:: shellypro3em-MAC_address_redacted SUBSCRIBE to shellypluspro3em-MAC_address_redacted/command/sys tcp{client}: 0x5590804a28 2024-03-28 13:09:38.413 openLuup.mqtt:: shellypro3em-MAC_address_redacted SUBSCRIBE to shellypluspro3em-MAC_address_redacted/command tcp{client}: 0x5590804a28 2024-03-28 13:09:38.425 openLuup.mqtt:: shellypro3em-MAC_address_redacted SUBSCRIBE to shellies/command tcp{client}: 0x5590804a28 2024-03-28 13:09:38.427 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/online true 2024-03-28 13:09:38.427 luup.register_handler:: global_function_name=Shelly_Plus_Handler, request=mqtt:shellypluspro3em-MAC_address_redacted/# 2024-03-28 13:09:38.429 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/rpc { "id":"0x55902bb480", "method":"Shelly.GetConfig", "src":"shelly-gen2-cmd" } 2024-03-28 13:09:38.432 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/ble {} 2024-03-28 13:09:38.460 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/cloud {"connected":false} 2024-03-28 13:09:38.463 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/em:0 { "id": 0, "a_current": 0.115, "a_voltage": 0, "a_act_power": 0, "a_aprt_power": 0, "a_pf": 0, "a_freq": 0, "b_current": 0.109, "b_voltage": 0, "b_act_power": 0, "b_aprt_power": 0, "b_pf": 0, "b_freq": 0, "c_current": 0.104, "c_voltage": 239.7, "c_act_power": 0, "c_aprt_power": 25.2, "c_pf": 0, "c_freq": 50, "n_current": null, "total_current": 0.328, "total_act_power": 0, "total_aprt_power": 25.234, "user_calibrated_phase": [] } 2024-03-28 13:09:38.466 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/emdata:0 { "id": 0, "a_total_act_energy": 0.04, "a_total_act_ret_energy": 0, "b_total_act_energy": 0.05, "b_total_act_ret_energy": 0, "c_total_act_energy": 0.07, "c_total_act_ret_energy": 0.2, "total_act": 0.16, "total_act_ret": 0.2 } 2024-03-28 13:09:38.468 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/eth {"ip":null} 2024-03-28 13:09:38.470 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/modbus {} 2024-03-28 13:09:38.475 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/mqtt {"connected":true} 2024-03-28 13:09:38.477 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/sys { "mac": "MAC_address_redacted", "restart_required": false, "time": "13:09", "unixtime": 1711591778, "uptime": 1, "ram_size": 240520, "ram_free": 121936, "fs_size": 524288, "fs_free": 192512, "cfg_rev": 11, "kvs_rev": 0, "schedule_rev": 0, "webhook_rev": 0, "available_updates": {}, "reset_reason": 3 } 2024-03-28 13:09:38.479 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/temperature:0 { "id": 0, "tC": 47.7, "tF": 117.8 } 2024-03-28 13:09:38.482 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/wifi {"sta_ip":"Shelly_IP_redacted","status":"got ip","ssid":"SID_redacted","rssi":-62} 2024-03-28 13:09:38.484 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/ws {"connected":false} 2024-03-28 13:09:38.487 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/status/mqtt {"connected":true} 2024-03-28 13:09:38.490 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/events/rpc { "src": "shellypro3em-MAC_address_redacted", "dst": "shellypluspro3em-MAC_address_redacted/events", "method": "NotifyFullStatus", "params": { "ts": 1711591778.07, "ble": {}, "cloud": { "connected": false }, "em:0": { "id": 0, "a_current": 0.115, "a_voltage": 0, "a_act_power": 0, "a_aprt_power": 0, "a_pf": 0, "a_freq": 0, "b_current": 0.109, "b_voltage": 0, "b_act_power": 0, "b_aprt_power": 0, "b_pf": 0, "b_freq": 0, "c_current": 0.104, "c_voltage": 239.7, "c_act_power": 0, "c_aprt_power": 25.2, "c_pf": 0, "c_freq": 50, "n_current": null, "total_current": 0.328, "total_act_power": 0, "total_aprt_power": 25.234, "user_calibrated_phase": [] }, "emdata:0": { "id": 0, "a_total_act_energy": 0.04, "a_total_act_ret_energy": 0, "b_total_act_energy": 0.05, "b_total_act_ret_energy": 0, "c_total_act_energy": 0.07, "c_total_act_ret_energy": 0.2, "total_act": 0.16, "total_act_ret": 0.2 }, "eth": { "ip": null }, "modbus": {}, "mqtt": { "connected": true }, "sys": { "mac": "MAC_address_redacted", "restart_required": false, "time": "13:09", "unixtime": 1711591778, "uptime": 1, "ram_size": 240596, "ram_free": 123484, "fs_size": 524288, "fs_free": 192512, "cfg_rev": 11, "kvs_rev": 0, "schedule_rev": 0, "webhook_rev": 0, "available_updates": {}, "reset_reason": 3 }, "temperature:0": { "id": 0, "tC": 47.7, "tF": 117.8 }, "wifi": { "sta_ip": "Shelly_IP_redacted", "status": "got ip", "ssid": "SID_redacted", "rssi": -62 }, "ws": { "connected": false } } } 2024-03-28 13:09:38.493 luup.shelly:207: ShellyPlus: shellypluspro3em-MAC_address_redacted/events/rpc { "src": "shellypro3em-MAC_address_redacted", "dst": "shellypluspro3em-MAC_address_redacted/events", "method": "NotifyStatus", "params": { "ts": 1711591778.07, "mqtt": { "connected": true } } } 2024-03-28 13:09:38.539 luup.shelly:207: ShellyGen2: shelly-gen2-cmd/rpc { "id": "0x55902bb480", "src": "shellypro3em-MAC_address_redacted", "dst": "shelly-gen2-cmd", "result": { "ble": { "enable": false, "rpc": { "enable": false }, "observer": { "enable": false } }, "cloud": { "enable": false, "server": "iot.shelly.cloud:6012/jrpc" }, "em:0": { "id": 0, "name": null, "blink_mode_selector": "active_energy", "phase_selector": "all", "monitor_phase_sequence": false, "reverse": {} }, "emdata:0": {}, "eth": { "enable": true, "ipv4mode": "dhcp", "ip": null, "netmask": null, "gw": null, "nameserver": null }, "modbus": { "enable": false }, "mqtt": { "enable": true, "server": "server_IP_address_redacted:1883", "client_id": "shellypro3em-MAC_address_redacted", "user": null, "ssl_ca": null, "topic_prefix": "shellypluspro3em-MAC_address_redacted", "rpc_ntf": true, "status_ntf": true, "use_client_cert": false, "enable_rpc": true, "enable_control": true }, "sys": { "device": { "name": null, "mac": "MAC_address_redacted", "fw_id": "20240223-141900/1.2.2-g7c39781", "discoverable": true, "eco_mode": false, "profile": "triphase", "addon_type": null }, "location": { "tz": "redacted", "lat": redacted, "lon": redacted }, "debug": { "level": 2, "file_level": null, "mqtt": { "enable": false }, "websocket": { "enable": false }, "udp": { "addr": null } }, "ui_data": {}, "rpc_udp": { "dst_addr": null, "listen_port": null }, "sntp": { "server": "time.google.com" }, "cfg_rev": 11 }, "temperature:0": { "id": 0, "name": null, "report_thr_C": 5, "offset_C": 0 }, "wifi": { "ap": { "ssid": "ShellyPro3EM-MAC_address_redacted", "is_open": true, "enable": false, "range_extender": { "enable": false } }, "sta": { "ssid": "SID_redacted", "is_open": false, "enable": true, "ipv4mode": "dhcp", "ip": null, "netmask": null, "gw": null, "nameserver": null }, "sta1": { "ssid": null, "is_open": true, "enable": false, "ipv4mode": "dhcp", "ip": null, "netmask": null, "gw": null, "nameserver": null }, "roam": { "rssi_thr": -80, "interval": 60 } }, "ws": { "enable": false, "server": null, "ssl_ca": "ca.pem" } } } 2024-03-28 13:09:38.540 luup.shelly:207: New Shelly announced: shellypro3em-MAC_address_redacted 2024-03-28 13:09:38.542 luup.create_device:: [30004] D_GenericShellyDevice.xml / / D_GenericShellyDevice.json (GenericShellyDevice) 2024-03-28 13:09:38.542 luup.attr_set:: 30004.ip = 2024-03-28 13:09:38.542 luup.attr_set:: 30004.mac = Shelly_IP_redacted <-- loaded with correct value 2024-03-28 13:09:38.542 luup.attr_set:: 30004.model = shellypro3em 2024-03-28 13:09:38.542 luup.attr_set:: 30004.firmware = 20240223-141900/1.2.2-g7c39781 2024-03-28 13:09:38.956 openLuup.server:: request completed (6784 bytes, 1 chunks, 11054 ms) tcp{client}: 0x558fe2b248
A few notes.
- You have to enable "Generic status update over MQTT" in the device's web page to get things to work. Same as for the H&T device. It defaults to disabled from the factory.
- Subscribing to "ShellyPlus: shellypluspro3em-MAC_address_redacted/events/rpc" and looking for "method": "NotifyFullStatus" results in pretty much all the information needed. Same as for the H&T device.
- It would be nice if the log pretty printed big json blocks. Could possibly just pretty print if the json string was say greater than 40 characters?
Here is the "method": "NotifyFullStatus" for the H&T device:
{ "src": "shellyplusht-MAC_address_redacted", "dst": "shellyplusht-MAC_address_redacted/events", "method": "NotifyFullStatus", "params": { "ts": 1.47, "ble": {}, "cloud": { "connected": false }, "devicepower:0": { "id": 0, "battery": { "V": 0.43, "percent": 0 }, "external": { "present": true } }, "ht_ui": {}, "humidity:0": { "id": 0, "rh": 50.9 }, "mqtt": { "connected": true }, "sys": { "mac": "MAC_address_redacted", "restart_required": false, "time": null, "unixtime": null, "uptime": 1, "ram_size": 246472, "ram_free": 167120, "fs_size": 458752, "fs_free": 192512, "cfg_rev": 15, "kvs_rev": 0, "webhook_rev": 0, "available_updates": {}, "wakeup_reason": { "boot": "deepsleep_wake", "cause": "status_update" }, "wakeup_period": 600, "reset_reason": 8 }, "temperature:0": { "id": 0, "tC": 24, "tF": 75.2 }, "wifi": { "sta_ip": "Shelly_IP_redacted", "status": "got ip", "ssid": "SID_redacted", "rssi": -68 }, "ws": { "connected": false } } }
Immediately above is the "method": "NotifyFullStatus" for the H&T device.
-
Could you give the latest development version a go?
It should work without your above edits, but I haven’t customised the device yet.
What variables does that give you?Using the default prefix "shellypro3em" I now get these variables. Previously there were none. See below. For the attributes I get firmware version, model number, MAC address but no IP address.
em/0/a_act_power 0 em/0/a_aprt_power 0 em/0/a_current 0.028 em/0/a_freq 0 em/0/a_pf 0 em/0/a_voltage 0 em/0/b_act_power 0 em/0/b_aprt_power 0 em/0/b_current 0.027 em/0/b_freq 0 em/0/b_pf 0 em/0/b_voltage 0 em/0/c_act_power 0 em/0/c_aprt_power 6.4 em/0/c_current 0.027 em/0/c_freq 50 em/0/c_pf 0 em/0/c_voltage 236.6 em/0/id 0 em/0/total_act_power 0 em/0/total_aprt_power 6.409 em/0/total_current 0.082 em/0/user_calibrated_phase [] emdata/0/a_total_act_energy 0.06 emdata/0/a_total_act_ret_energy 0 emdata/0/b_total_act_energy 0.06 emdata/0/b_total_act_ret_energy 0 emdata/0/c_total_act_energy 0.12 emdata/0/c_total_act_ret_energy 0.38 emdata/0/id 0 emdata/0/total_act 0.24 emdata/0/total_act_ret 0.38 temperature/0/id 0 temperature/0/tC 46.7 temperature/0/tF 116
Note the device does not have the current clamps connected around anything. ie it's just powered up.