I have included a Philips light in my Home Assistant setup, with the xiaomi_miio platform.
In parallel, I also have a couple of Yeelights included in Home Assistant.
In what concerns to the Philips light, it doesn’t seem to become unavailable as the Yeelight, when turned off in the physical light switch or not available in the network (it either stays turned on/off on frontend).
Example of how a Yeelight appears when not connected to the network:
Is there something that can be done or does the platform need to be fixed to be consistent with other lights?
I’m unsure about the unavailable feature. The PlatformNotReady behavior (device doesn’t show up if not found) was suggested by some other people. I’m unsure about the right direction.
Mijia lamp is currently on the way, coming from an European warehouse to a european country, so it should be quick. I’ll drop you a message once it arrives and have it setup.
Now that I think about it, maybe it will also work with the Yeelight component. I’ll try both anyway.
You are right. Unfortunately the feature cannot be easily achieved. The light.xiaomi_miio tries to autodetect the device type and chooses the appropriate device class. I cannot create a proper device without a knowledge about the “unavailable hardware”. In future all xiaomi_miio devices are handled by auto-discovery. I’m afraid showing a “unavailable device” will be hard.
First of all, thanks a lot for the in-depth explanation. I see your doubt, it all makes more sense now.
What about having a default light device class to be assigned only when device is unavailable (considering that you’re not able to actually determine the real device class)?
This would allow you to show it as unavailable, but then you’d also need to be able to redetermine the device class if it would become available in the meanwhile (and I don’t know if that’s possible without restarting HA).
The feature is now available at the custom component for testing. Please add the device model to your configuration to avoid a failing auto-detection of a unreachable device: