Closed DarkShortie closed 1 year ago
I got it now working using service instead of device in the automation ui. But I think adding also a device would be still good.
This gave me a mayor headache today for several hours. I think the reason why there's no device is that this component uses the setup
function in its __init__.py
and not async_setup_entry
. I'm adding support for stuff like actually toggling or switching from automatic to manual mode, but if these other entities are not grouped with the cover entity in a device, things become messy quickly.
According to the developer documentation setup
is the same as async_setup
. setup
is used for synchronous code and since pyduofern uses threading that's what we have to use.
If I were to start implementing a device this is where I'd start. Back in the day (when I implemented pyduofern for Homeassistant) I believe the standard way of controlling things was calling services.
It seems that a lot more config flow needs to be written to add a device. I won't implement this any time soon given that the "service" way of calling the entities works just fine.
Don't get me wrong, I don't blame you at all (might be possible the config flow didn't even exist yet, when you started working on this? Not sure, I kinda remember it being new). I started at exactly the link you posted, but the documentation is vague at best about the whole topic of when this works and when it doesn't. Would you be open for MRs about this? I wanted to upstream my button-implementations anyhow. Not sure when I can get it from "working, but horrible" to "I can let other people see this", but definitely want to.
Yes you are right, when I first implemented this there was no config flow yet and everything was configured in homeassistant.yaml
. No worries, I didn't take it badly.
Googling the links for my first message got my hopes up a bit that adding a device_info
property would already be sufficient to make a device. But then after an hour of experimenting I realized that on top of that it seems to need more config flow to enable devices. My experience while writing the (admittedly not very good) config flow for the setup was that config flow does not at all come easy to me. I wholeheartedly agree with your remark about vague documentation. A few years ago it took me most of my evenings for a week or more just to get just that piece of config flow working to enable use with HACS without editing a config file. And another few evenings I spent in vain a few months later trying to write a halfway decent config flow for device pairing (and I think that's exactly the one that would be required to support devices). This likely explains why my second message sounded less than optimistic.
I'm definitely open to MRs about this (or pyduofern/hacs in General).
Won't v0.5.1 solve this (at least for shutters)?
this was implemented in #28 thanks to t-animal
I've just installed this integration and added 3 blinds. For this I also got the entities and I'm able to control the blinds from Home Assistant.
As a next step I wanted to create some automations with the blinds. But I can't select them in the UI, because the entities don't belong to a device. It would be great if a device is created and the entity is assigned to it.