openhab / openhab-addons

Add-ons for openHAB

Home Page:https://www.openhab.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[shelly] Addon channels not discovered when in cover mode with Shelly Plus 2PM #14

aenotiad opened this issue · comments

Moving this from Markus' repo to here

Openhab 4.0.3 stable as openhabian on Pi 4B
Shelly binding installed from UI
Shelly plus 2pm version 1.0.3 with sensor add-on and DS18B20
When discovering the Shelly and adding it to the things DB the temperature sensor in the add-on is added as a channel only if the Shelly is in switch mode. If in cover mode then the Shelly reports the add-on during the thing add process but the channel never gets created.

[Edit] - Tested on 4.2.0 snapshot #4072 with similar results

Relevant messages when in switch mode
2023-09-24 19:36:20.445 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyplus2pm-c049ef8b2474: Shelly Add-On detected with at least 1 external sensor 2023-09-24 19:36:22.667 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-c049ef8b2474: NotifyStatus update received: {"id":1719399656,"src":"shellyplus2pm-c049ef8b2474","dst":"shellyplus2pm-c049ef8b2474","params":{"ble":null,"cloud":{"connected":false},"mqtt":{"connected":false},"sys":{"mac":"C049EF8B2474","restart_required":false,"time":"19:36","unixtime":1695573382,"uptime":86,"ram_size":257964,"ram_free":112932,"fs_size":458752,"fs_free":143360,"cfg_rev":10,"available_updates":null,"webhook_rev":2},"wifi":{"sta_ip":"192.168.10.230","status":"got ip","ssid":"HomeAuto","rssi":-46},"input:0":{"id":0,"state":false},"input:1":{"id":1,"state":false},"switch:0":{"id":0,"source":"init","output":false,"apower":0.0,"voltage":227.6,"current":0.0,"pf":0.0,"aenergy":{"total":0.0,"by_minute":[0.0,0.0,0.0],"minute_ts":1695573380},"temperature":{"tC":67.0,"tF":152.6}},"switch:1":{"id":1,"source":"init","output":false,"apower":0.0,"voltage":227.7,"current":0.0,"pf":0.0,"aenergy":{"total":0.0,"by_minute":[0.0,0.0,0.0],"minute_ts":1695573380},"temperature":{"tC":67.0,"tF":152.6}},"temperature:100":{"id":100,"tC":32.8,"tF":91.1}},"result":{"ble":{},"cloud":{"connected":false},"mqtt":{"connected":false},"sys":{"mac":"C049EF8B2474","restart_required":false,"time":"19:36","unixtime":1695573382,"uptime":86,"ram_size":257964,"ram_free":112932,"fs_size":458752,"fs_free":143360,"cfg_rev":10,"available_updates":{},"webhook_rev":2},"wifi":{"sta_ip":"192.168.10.230","status":"got ip","ssid":"HomeAuto","rssi":-46},"input:0":{"id":0,"state":false},"input:1":{"id":1,"state":false},"switch:0":{"id":0,"source":"init","output":false,"apower":0.0,"voltage":227.6,"current":0.0,"pf":0.0,"aenergy":{"total":0.0,"by_minute":[0.0,0.0,0.0],"minute_ts":1695573380},"temperature":{"tC":67.0,"tF":152.6}},"switch:1":{"id":1,"source":"init","output":false,"apower":0.0,"voltage":227.7,"current":0.0,"pf":0.0,"aenergy":{"total":0.0,"by_minute":[0.0,0.0,0.0],"minute_ts":1695573380},"temperature":{"tC":67.0,"tF":152.6}},"temperature:100":{"id":100,"tC":32.8,"tF":91.1}}} 2023-09-24 19:36:22.697 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyplus2pm-c049ef8b2474: Adding channel sensors#temperature1

Relevant messages when in cover mode

2023-09-24 19:43:58.649 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyplus2pm-c049ef8b2474: Shelly Add-On detected with at least 1 external sensor 2023-09-24 19:44:00.890 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-c049ef8b2474: NotifyStatus update received: {"id":212392860,"src":"shellyplus2pm-c049ef8b2474","dst":"shellyplus2pm-c049ef8b2474","params":{"ble":null,"cloud":{"connected":false},"mqtt":{"connected":false},"sys":{"mac":"C049EF8B2474","restart_required":false,"time":"19:44","unixtime":1695573840,"uptime":43,"ram_size":257688,"ram_free":109772,"fs_size":458752,"fs_free":143360,"cfg_rev":11,"available_updates":null,"webhook_rev":3},"wifi":{"sta_ip":"192.168.10.230","status":"got ip","ssid":"HomeAuto","rssi":-42},"input:0":{"id":0,"state":false},"input:1":{"id":1,"state":false},"cover:0":{"id":0,"source":"init","state":"stopped","apower":0.0,"voltage":226.6,"current":0.0,"pf":0.0,"aenergy":{"total":0.0,"by_minute":[0.0,0.0,0.0],"minute_ts":1695573840},"pos_control":false,"temperature":{"tC":66.9,"tF":152.5}},"temperature:100":{"id":100,"tC":32.8,"tF":91.1}},"result":{"ble":{},"cloud":{"connected":false},"mqtt":{"connected":false},"sys":{"mac":"C049EF8B2474","restart_required":false,"time":"19:44","unixtime":1695573840,"uptime":43,"ram_size":257688,"ram_free":109772,"fs_size":458752,"fs_free":143360,"cfg_rev":11,"available_updates":{},"webhook_rev":3},"wifi":{"sta_ip":"192.168.10.230","status":"got ip","ssid":"HomeAuto","rssi":-42},"input:0":{"id":0,"state":false},"input:1":{"id":1,"state":false},"cover:0":{"id":0,"source":"init","state":"stopped","apower":0.0,"voltage":226.6,"current":0.0,"pf":0.0,"aenergy":{"total":0.0,"by_minute":[0.0,0.0,0.0],"minute_ts":1695573840},"pos_control":false,"temperature":{"tC":66.9,"tF":152.5}},"temperature:100":{"id":100,"tC":32.8,"tF":91.1}}}

As you are using 4.0.3 a double check, this is not allready fixed?
See PR's since then:
https://github.com/openhab/openhab-addons/pulls?q=is%3Apr+shelly+created%3A%3E2023-11-01+is%3Amerged

I did - and it was not there :)
I also tested on the latest snapshot 4.2.0 build #4072 just in case :) and while there is a change in the channels reported the temperature channel added is the 'internal temperature' one rather than the addon

please try latest DEV build, logic has been added in roller mode and report result
https://github.com/markus7017/myfiles/blob/master/shelly/org.openhab.binding.shelly-4.2.0-SNAPSHOT.jar?raw=true

Channel now gets discovered and added as 'Outdoor Temperature' but does not seem to get updates when the temperature changes in the Shelly device.

Notification is sent by the Shelly device :

2024-05-12 14:06:23.719 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-c049ef8b2474: NotifyStatus update received: {"id":1519201963,"src":"shellyplus2pm-c049ef8b2474","dst":"shellyplus2pm-c049ef8b2474","params":{"ble":{},"cloud":{"connected":false},"mqtt":{"connected":true},"sys":{"mac":"C049EF8B2474","restart_required":false,"time":"14:06","unixtime":1715511983,"uptime":872771,"ram_size":257664,"ram_free":116748,"fs_size":458752,"fs_free":143360,"cfg_rev":23,"available_updates":{"stable":{"version":"1.3.1"}},"webhook_rev":3},"wifi":{"sta_ip":"192.168.10.230","status":"got ip","ssid":"HomeAuto","rssi":-47},"input:0":{"id":0},"input:1":{"id":1},"cover:0":{"id":0,"source":"limit_switch","state":"open","apower":0.0,"voltage":226.1,"current":0.0,"pf":0.0,"aenergy":{"total":35.869,"by_minute":[0.0,0.0,0.0],"minute_ts":1715511983},"current_pos":100,"pos_control":true,"temperature":{"tC":59.7,"tF":139.4}},"temperature:100":{"id":100,"tC":30.8,"tF":87.5}},"result":{"ble":{},"cloud":{"connected":false},"mqtt":{"connected":true},"sys":{"mac":"C049EF8B2474","restart_required":false,"time":"14:06","unixtime":1715511983,"uptime":872771,"ram_size":257664,"ram_free":116748,"fs_size":458752,"fs_free":143360,"cfg_rev":23,"available_updates":{"stable":{"version":"1.3.1"}},"webhook_rev":3},"wifi":{"sta_ip":"192.168.10.230","status":"got ip","ssid":"HomeAuto","rssi":-47},"input:0":{"id":0},"input:1":{"id":1},"cover:0":{"id":0,"source":"limit_switch","state":"open","apower":0.0,"voltage":226.1,"current":0.0,"pf":0.0,"aenergy":{"total":35.869,"by_minute":[0.0,0.0,0.0],"minute_ts":1715511983},"current_pos":100,"pos_control":true,"temperature":{"tC":59.7,"tF":139.4}},"temperature:100":{"id":100,"tC":30.8,"tF":87.5}}}

Running the supplied jar in 4.2.0 build #4077

Did another test on another device that has a DHT-22 sensor and the binding does discover both channels - Temperature and Humidity - but still does not update them.
lmk if I can help in any better way

please try the updated build

Seems to work! Both the DS sensor from one add-on and the DHT-22 from another one get discovered properly and reported properly.
Also did some more through testing adding one of all the types of Shelly devices I have in my network ie
2pm
dimmer2
2.5 switch

with all their main channels and they seem to work all fine :)

Thanks!

I assume this will roll into the 4.2 release when out?

thanks for feedback !