home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.

Home Page:https://www.home-assistant.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shelly devices turning on whenever network goes offline and comes back online

yesterdayshero opened this issue · comments

The problem

Several of my Shelly devices are turning on when my network goes offline then comes back online. In the logs, the device will go from off to unavailable. Then when the network comes back online they'll switch to on.

Devices that is has occurred on include:

  • Shelly Dimmer 2
  • Shelly 1PM Plus
  • Shelly 1 Plus

To see whether it's being caused by Home Assistant or Shelly, I've turned off my Home Assistant instance, rebooted my network, and the issue doesn't occur. It only occurs if my network goes down while Home Assistant is running.

I have also tested:

  • Some Shelly devices having cloud access or not - occurs on both
  • Power on default setting for the Shelly being Off or On - occurs on both

I haven't seen any errors coming up in my logs either.

What version of Home Assistant Core has the issue?

2022.5.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Shelly

Link to integration documentation on our website

https://www.home-assistant.io/integrations/shelly/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Hey there @balloob, @bieniu, @thecode, @chemelli74, mind taking a look at this issue as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Seem to be getting a similar problem with a Shelly 1 (used for garage door control) where the input will go to "on" randomly, indicating the door is up when it isn't.

Seem to be getting a similar problem with a Shelly 1

@grantclem not the same issue, please create a new issue

Please download the diagnostics file from the device card in Home Assistant and attach it in a comment.

Please download the diagnostics file from the device card in Home Assistant and attach it in a comment.

Thanks @thecode. This should be it, but let me know if this isn't what you meant.

config_entry-shelly-96d6e3956c37eb0e468ed4f66c573094.json.txt

Yes this is the file.
The Shelly integration doesn't control anything by itself. especially that your list has both Gen1 & Gen2 devices which uses different protocols.
There are two reasons that may cause this:

  1. An automation that is running on the state change from unavailable
  2. MQTT with retain - if the devices are connected to MQTT and you used retain in the past the MQTT server will store the last message and send it on every connect.

How do debug it:

  1. You can enable log on the Shelly device which will show the source for the control (mqtt/http call)
  2. If you want to check what is Shelly sending, add the following to configuration.yaml, restart home assistant, and attach the log after you reproduce the problem.
logger:
  default: info
  logs:
    aioshelly: debug 
    homeassistant.components.shelly: debug

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

Thanks

Thanks @thecode. I'm not using MQTT, but will set up the other logs, do more testing and come back with my results.

@thecode I've tried running the logs as you mentioned. I've attached the Shelly log, but can't seem to upload the Home Assistant log, as I think it's too large. Is there a way to extract just the Shelly log that you helped me set up with the config update?

Just note that this time the issue only happened on a different set of lights. It seems a bit inconsistent so it's hard to pick. The Dining Room Lights were the ones to go on. They triggered on when the network became unavailable, then switched off when the network was restored. This happened at 10:29 AM.

If you can point me in the right direction in terms of what I should look out for and how best to search the logs, I'm happy to run more tests to try debug further.

Log from Shelly device: dining-log.txt