openLuup: Shelly Bridge plugin
-
I obviously need to get one of these myself… but the UK store is currently out of stock.
-
Yes - they are a nice unit. The large display is easy to read. This guy does a good rant on the Shelley MQTT info.
I also got one of these zigbee devices: Aqara temperature, humidity, TVOC air quality monitor. The latter has smaller display than the Shelley. Both devices give very similar temperature readings but a substantial 10% difference in the humidity readings. I can't be certain but it looks like the zigbee device is less likely to be showing the correct figure. You can add offsets, etc but not too sure how you would actually go about calibrating it.
-
Yes, I’ve found significant humidity variation between different devices in the past. It’s a much harder measurement to make accurately than temperature.
-
I see that Shelly have now come out with Gen 3 devices, which may explain why there are none of the old ones available now.
-
Well I compared another Xiaomi humidity temperature device with the Shelley device and got a good match in the readings. It looks like the Shelly device and this particular Xiaomi device are literally out by the old software error factor of one ie a 10% difference. There is an OTA software update available but I can't get it to happen.
Anyway I got one of the hairs off my head and proceeded to calibrate it against the Shelly and the Xiaomi devices. I searched & searched and could only find a hair about 2 mm long. Complete waste of time. Maybe alopecia has set in?
Great to see the Gen3 device ( they've shrunk the kids once again) - looks like you have your work cut out for you re: openLuup. About a year from now; we'll get to see them on sale here where I live.
-
Shelly Plus H&T now back in stock, so I've ordered one.
-
Good news and I still haven't forgotten about Zwave via MQTT! Starting point, at a minimum, would be:
- light on/off (although most are dimmers these days, but not all)
- blinds up/down - pretty much the same as the above
- general purpose outlets (GPO) - pretty much the same as the above
- minimotes
Some items may be returning power consumption info as well.
The above would cover the majority of stuff?
-
This error is looking very weird: the server says the socket is ready to read, but the read fails. I've added an extra check for the status just before the read, and it looks like this is, indeed, the case.
Apart from blaming a flakey LuaSocket module, I can't, as yet, think how this happens. So still working on it...
-
Latest development version (v24.2.8) now supports the Shelly Plus H&T. It should detect a new device when it is reset or generates a normal update. There is a parent Shelly device and temperature and humidity child devices.
The unexplained fixed header byte error remains, but it has no impact since the connection with the device is closed anyway, and the connection remade when the device wakes up again.
I have rounded the humidity reading to the nearest integer, since there's no way that it's that accurate.
-
Tried out the latest software:
-
line 583: The newinfo.ip is null, so the software does a return and no device is created. I think, if a static address is set up in the Shelley, this may return an IP address. But I'm using DCHP with statics set there.
-
I bypassed the return code by setting the ip address to "1.1.1.1". At line 588 sys.device.name is null. So I gave it a fake name "Shelley_Name" regardless later on you seem to have populated with shellyplusht-<the_id>.
-
After setting up the bypass: the parent device was created with the two children. The handler is hit every five minutes and only stops running once it realises the device already exists in function init_device() at line 463. Can this exit be determined earlier in the handler (just my OCD on wasted CPU cycles)?
-
The children aren't populated. You have to subscribe to "shellyplusht-<the_id>/events/rpc". Refer to this guys vid. And then look specifically for the event that contains this "method": "NotifyFullStatus". It contains all the good info.
-
You can then get the temp & humidity and also the ip address. The battery info has a flag indicating if running of USB (ie 5 Volts) or not. The device id is the Mac address. When you read the mac address, it has had all the colons or dashes removed. Can they be put back in when the MAC address is stored in the device attributes?
Here is the NotifyFullStatus event json and after that I have attached the json used when the device is being created.
So making good progress.
{ "src": "shellyplusht-<the_id>", "dst": "shellyplusht-<the_id>/events", "method": "NotifyFullStatus", "params": { "ts": 9.37, "ble": {}, "cloud": { "connected": false }, "devicepower:0": { "id": 0, "battery": { "V": 0.43, "percent": 0 }, "external": { "present": true } }, "ht_ui": {}, "humidity:0": { "id": 0, "rh": 54.2 }, "mqtt": { "connected": true }, "sys": { "mac": "<the_id>", "restart_required": false, "time": null, "unixtime": null, "uptime": 9, "ram_size": 246872, "ram_free": 167920, "fs_size": 458752, "fs_free": 176128, "cfg_rev": 11, "kvs_rev": 0, "webhook_rev": 0, "available_updates": {}, "wakeup_reason": { "boot": "deepsleep_wake", "cause": "status_update" }, "wakeup_period": 600 }, "temperature:0": { "id": 0, "tC": 24.8, "tF": 76.7 }, "wifi": { "sta_ip": "the_IP", "status": "got ip", "ssid": "the_SID", "rssi": -75 }, "ws": { "connected": false } } }
Device creation - topic "shelly-gen2-cmd/rpc":
{ "id": "table: 0x55a8a880e0", "src": "shellyplusht-<the_id>", "dst": "shelly-gen2-cmd", "result": { "ble": { "enable": false, "rpc": { "enable": true } }, "cloud": { "enable": false, "server": "iot.shelly.cloud:6012/jrpc" }, "devicepower:0": {}, "ht_ui": { "temperature_unit": "C" }, "humidity:0": { "id": 0, "name": null, "report_thr": 5, "offset": 0 }, "mqtt": { "enable": true, "server": "server_ip:1883", "client_id": "shellyplusht-<the_id>", "user": null, "topic_prefix": "shellyplusht-<the_id>", "rpc_ntf": true, "status_ntf": false, "use_client_cert": false, "enable_rpc": true, "enable_control": true }, "sys": { "device": { "name": null, "mac": "<the_id>", "fw_id": "20231106-160224/1.0.8-gdba0ee3", "discoverable": true }, "location": { "tz": "some-place", "lat": "lat", "lon": "lon" }, "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": 0.5, "offset_C": 0 }, "wifi": { "ap": { "ssid": "ShellyPlusHT-<the_id>", "is_open": true, "enable": false }, "sta": { "ssid": "some_SID", "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" } } }
-
-
None of this is needed for my config, but indeed I do have a static IP defined.
-
Edit : that didn't sound to good on 2nd read, so: yes I'm unsure why you would need an ip address, so not so concerning.
-
IP was used for HTTP request to get device name in an early version, and that piece of code remained.
The whole point of MQTT is that it doesn’t need one, of course.
Edit: It is, however, used to the browser window in the openLuup device page of the parent device, so that you can interact directly with the it for firmware updates, etc..
-
Try development latest version (v24.2.11).
Valid child readings should happen on next device update (ie. time interval or temperature/humidity significant change)
I've tested this with a DCHP configuration and it works OK.
-
Now working. Thank you. Will get back to you with a full report.
-
a-lurkerreplied to a-lurker on Feb 14, 2024, 6:04 AM last edited by a-lurker Feb 14, 2024, 1:24 AM
Working fine except for a couple of small points. In the earlier H&T device the battery topic is:
shellies/shellyht-<deviceid>/sensor/battery
In the newer device it's:
shellyplusht-<Device_ID>/status/devicepower:0
and returns:
{ "id": 0, "battery": { "V": 0.43, "percent": 0 }, "external": { "present": true } }
It would be good if "external" is true ie USB powered; that battery percent is set to 100% and the Voltage (variable V) to 5 Volts. ie USB Voltage. Any battery values are incorrect, as you are meant to remove the batteries, when running off USB power.
Interesting the battery percent in the UI dashboard for the parent device shows the value of "CurrentLevel" ie the actual humidity percentage measured. Not sure how that got in there! Looks like if the battery level is missing, something else gets plugged into there.
The service urn:micasaverde-com:serviedId:HumiditySensor1 service saves the humidity as "CurrentLevel". In the Historian rules this gets picked up as Current as in Amperes.
CurrentHumidityLevel would have been nice but that's MIOS.
-
Please try development latest version (v24.2.14) for power V and %.
Don't understand your comments on UI dashboard and Historian rules.
-
My wishes have been granted on the USB! The parent device shows the humidity % just to the right of the Shelley Icon. Not sure why the temperature is not there as well. Sounds like an AltUI thing. Sorry; got a bit confused between the battery percentage and the humidity, so ignore that. The v variable should be a capital V for Volts but that's my OCD again. So looking good. Thanks.
-
Oh, you’re looking at AltUI. I don’t even have that installed on my production system since everything configuration-related can be done with the openLuup console.
I agree with ‘V’, however the ‘v’ is a hangover from the native naming in earlier Shellies. It should probably be in a different service anyway.