How to find the cause of a warning in my logs

I’ve been working on clearing causes of errors and warnings my logs for the past couple of weeks. I have one that has been popping up regularly. It is a switch entity for a Shelly One relay. The switch quit working…lost its wifi connection. I reset it, but the warning persists. What is causing it and how do I fix it?

Logger: homeassistant.components.switch.reproduce_state
Source: components/switch/reproduce_state.py:38
Integration: Switch (documentation, issues)
First occurred: December 13, 2022 at 18:36:24 (3 occurrences)
Last logged: 07:16:51

Invalid state specified for switch.cabinet_lights: unavailable

Do you have an automation for this device that looks at a state change?
It might be in there

No automation, but that switch is set on/off in several scenes. Also I have a aux light card that can switch the switch on/off.

That is considered as expected behavior: „unavailable“ as invalid state specified · Issue #79476 · home-assistant/core · GitHub

Ok. When that switch lost its wifi connection, for some reason the state was changed in the scene to unavailable. I deleted the switch and readded it and now the error is gone.

I really wish that there was a view yaml added to the scene ui. It would have made finding this a lot easier to find.