Something is sending ON command to Shelly switch

Hi,

I’m using Openhab 3.4 stable on Ubuntu 20.04.5 LTS on Raspberry Pi 4B.

I have following problem, something, I cannot find what is sending randomly (sometimes one time per hour, sometimes 10) command ON to second Power channel of Shelly Plus 2 PM (latest stable firmware).

I have no rule which can send such order to shelly. Additionally it is only for second channel, there is no problem with first channel.

I started UDP debuging on shelly using nc on openhab shell and have someting like that:

‘’’
shellyplus2pm-90380c35a424 792 10394.189 2 1|mg_rpc.c:438 0x3ffb77ec: duplicate id ‘shellyplus2pm-90380c35a424’
shellyplus2pm-90380c35a424 793 10394.202 2 2|mg_rpc.c:314 Shelly.GetStatus via HTTP 192.168.1.110:34444
shellyplus2pm-90380c35a424 794 10395.295 2 2|mgos_http_server.c:180 0x3ffd4714 HTTP connection from 192.168.1.110:34456
shellyplus2pm-90380c35a424 795 10395.311 2 1|mg_rpc.c:438 0x3ffb7814: duplicate id ‘shellyplus2pm-90380c35a424’
shellyplus2pm-90380c35a424 796 10395.324 2 2|mg_rpc.c:314 Switch.Set via HTTP 192.168.1.110:34456
shellyplus2pm-90380c35a424 797 10395.342 2 2|shelly_notification:161 Status change of switch:1: {“id”:1,“output”:true,“source”:“HTTP”}
shellyplus2pm-90380c35a424 798 10396.234 2 2|shelly_notification:161 Status change of switch:1: {“id”:1,“apower”:18.7}
shellyplus2pm-90380c35a424 799 10396.249 2 2|shelly_notification:161 Status change of switch:1: {“id”:1,“current”:0.116}
shellyplus2pm-90380c35a424 800 10396.262 2 2|shelly_notification:161 Status change of switch:1: {“id”:1,“pf”:0.75}
shellyplus2pm-90380c35a424 801 10397.235 2 2|shelly_notification:161 Status change of switch:1: {“id”:1,“apower”:15.1}
shellyplus2pm-90380c35a424 802 10397.267 2 2|mgos_http_server.c:180 0x3ffdb014 HTTP connection from 192.168.1.110:34464
shellyplus2pm-90380c35a424 803 10397.277 2 1|mg_rpc.c:438 0x3ffb7814: duplicate id ‘shellyplus2pm-90380c35a424’
shellyplus2pm-90380c35a424 804 10397.290 2 2|mg_rpc.c:314 Shelly.GetStatus via HTTP 192.168.1.110:34464
‘’’

192.168.1.110 is address of openhab. I additionally recreate second power item and reboot openhab - it did not helped.

How I can check what is sending this ON command to shelly ?

Thanks

Have you exposed your OH installation to the internet by using simple port forwarding on your router ?
In that case it may be that someone found your OH installation and plays a game with you …
There are several reports of others which made a similar experience.

Hi @Andy_Co,

First, please use code fences for the integration of logs. This makes your post a lot easier to read :grinning: Like this:

shellyplus2pm-90380c35a424 804 10397.290 2 2|mg_rpc.c:314 Shelly.GetStatus via HTTP 192.168.1.110:34464

To topic:
Did you have a look into the openhab logs? Is there any irregularity you can see there?
And also did you try to set the log level of openhab to DEBUG for more detailed logs ok the Shelly binding?

Regards
Jonathan

No, it is not exposed to internet.

Hi,

I cannot see anything strange in common openhab.log (or even nothing related to it). When I turned on the DEBUG for Shelly binding I still can’t see what exactly is causing switching on.

‘’’
2023-01-24 21:25:59.286 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-90380c35a424: NotifyStatus update received: {“src”:“shellyplus2pm-90380c35a424”,“dst”:“shellyplus2pm-90380c35a424”,“method”:“NotifyStatus”,“params”:{“ts”:1.67459196067E9,“switch:0”:{“id”:0,“aenergy”:{“total”:0.705,“by_minute”:[0.0,0.0,0.0],“minute_ts”:1674591959}}}}
2023-01-24 21:25:59.344 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-90380c35a424: NotifyStatus update received: {“src”:“shellyplus2pm-90380c35a424”,“dst”:“shellyplus2pm-90380c35a424”,“method”:“NotifyStatus”,“params”:{“ts”:1.67459196067E9,“switch:1”:{“id”:1,“aenergy”:{“total”:11.601,“by_minute”:[43.136,0.0,39.751],“minute_ts”:1674591959}}}}
2023-01-24 21:26:21.610 [DEBUG] [.internal.handler.ShellyRelayHandler] - shellyplus2pm-90380c35a424: Set relay output to ON
2023-01-24 21:26:21.812 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-90380c35a424: NotifyStatus update received: {“src”:“shellyplus2pm-90380c35a424”,“dst”:“shellyplus2pm-90380c35a424”,“method”:“NotifyStatus”,“params”:{“ts”:1.67459198323E9,“switch:1”:{“id”:1,“source”:“HTTP”,“output”:true}}}
2023-01-24 21:26:21.814 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyplus2pm-90380c35a424: Channel relay2#output updated with ON (type class org.openhab.core.library.types.OnOffType).
2023-01-24 21:26:22.290 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-90380c35a424: NotifyStatus update received: {“src”:“shellyplus2pm-90380c35a424”,“dst”:“shellyplus2pm-90380c35a424”,“method”:“NotifyStatus”,“params”:{“ts”:1.67459198369E9,“switch:1”:{“id”:1,“apower”:20.2}}}
2023-01-24 21:26:22.312 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyplus2pm-90380c35a424: Channel meter2#currentWatts updated with 20.20 W (type class org.openhab.core.library.types.QuantityType).
2023-01-24 21:26:22.317 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-90380c35a424: NotifyStatus update received: {“src”:“shellyplus2pm-90380c35a424”,“dst”:“shellyplus2pm-90380c35a424”,“method”:“NotifyStatus”,“params”:{“ts”:1.67459198369E9,“switch:1”:{“id”:1,“current”:0.124}}}
2023-01-24 21:26:22.323 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-90380c35a424: NotifyStatus update received: {“src”:“shellyplus2pm-90380c35a424”,“dst”:“shellyplus2pm-90380c35a424”,“method”:“NotifyStatus”,“params”:{“ts”:1.67459198369E9,“switch:1”:{“id”:1,“pf”:0.72}}}
2023-01-24 21:26:23.280 [DEBUG] [g.shelly.internal.api2.Shelly2ApiRpc] - shellyplus2pm-90380c35a424: NotifyStatus update received: {“src”:“shellyplus2pm-90380c35a424”,“dst”:“shellyplus2pm-90380c35a424”,“method”:“NotifyStatus”,“params”:{“ts”:1.6745919847E9,“switch:1”:{“id”:1,“apower”:15.5}}}
2023-01-24 21:26:23.285 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyplus2pm-90380c35a424: Channel meter2#currentWatts updated with 15.50 W (type class org.openhab.core.library.types.QuantityType).
‘’’

How do you know that something within OH is sending a command to your Shelly?

The shelly can also be controlled via web, Alexa etc. Maybe within OH you only see the result of another external activity, therefore I would try to disable the shelly thing and see if the issue is still occurring (I had once an Alexa routine only created for testing, that I forgot about :wink: )

I have 20 or more Shelly devices, this the new one only addes without any rules.

How I know that is from openhab:

‘’’
shellyplus2pm-90380c35a424 796 10395.324 2 2|mg_rpc.c:314 Switch.Set via HTTP 192.168.1.110:34456
shellyplus2pm-90380c35a424 797 10395.342 2 2|shelly_notification:161 Status change of switch:1: {“id”:1,“output”:true,“source”:“HTTP”}
‘’’

Shelly is disconnected from Shelly Cloud, GA is not configured, there are no rules for switching ON device. Still on DEBUG log i have following:

‘’’
2023-01-25 08:08:35.136 [DEBUG] [nternal.profiles.ProfileCallbackImpl] - Delegating command ‘ON’ for item ‘Shellyplus2pmSufitoweParterLazienka_Power2’ to handler for channel ‘shelly:shellyplus2pm-relay:2eae95f5e3:relay2#output’
2023-01-25 08:08:35.137 [DEBUG] [.internal.common.CombinedClassLoader] - Loaded class “org.openhab.core.thing.binding.ThingHandler” by classloader “org.eclipse.osgi.internal.loader.EquinoxClassLoader@15dc1e5a[org.openhab.binding.shelly:3.4.1(id=281)]” for “[class org.openhab.binding.shelly.internal.handler.ShellyRelayHandler]”
2023-01-25 08:08:35.137 [DEBUG] [.internal.common.CombinedClassLoader] - Loaded class “org.openhab.core.thing.ThingStatusInfo” by classloader “org.eclipse.osgi.internal.loader.EquinoxClassLoader@15dc1e5a[org.openhab.binding.shelly:3.4.1(id=281)]” for “[class org.openhab.binding.shelly.internal.handler.ShellyRelayHandler]”

‘’’

How can I check what is “Delegating command ‘ON’ for item Shellyplus2pmSufitoweParterLazienka_Power2’” ?

Long story simplified and short.

I have one old simple rule without logging which switch on all power outlets when my alarm system switched to “state 0” - when I come back to home and disarm the alarm. And I add this second power channel of Shelly to this group - this channel was steering fan in bathroom so it was easy to noticed that is on :slight_smile:

Unfortunately additionally to lack of logging in this one rule - also to have nice changing icon of Alarm System among other thing it has separate state to show that any of motion dectector is active at the moment.

And of course when all the motion detectors switch off, the Alarm system also switch to “state 0” and the rule is switching on all the connected power outlets. It was difficult to notice, because all other of the items in outlets groups should be on almost all the time.

So one conclusion is: always make a log even in the simpliest rule.

But I still have a question in what log I can check “what” put ON message for item ?