Hi,
I set out to develop an async component, but the documentation is lacking, and I cannot find a complete example of a component that has config loading flows, lights, sensors, and switches. I have looked at the hue component source, but there is a lot more going on there with connecting to the hubs and hues and so so so much boilerplate that I am lost. Is there a better starting point for developing an async component?
So I took a look at the deconz component and there a lot of parts that are very different than the hue component, which is just more confusing. Is there an empty async component example that doesn’t include a platform-specific discovery process or other platform-specific methods? I guess what is also confusing is that I’m trying to read through the source files and link where things are called from where, but there have to be a hundred different functions. I know these things take time and effort, and I’m only asking because I think that is what would help most, but are there plans for full async docs in the roadmap?
I guess one thing I have been struggling with is just a list of all of the async methods that I need to assign and what their expected output is. For example, what do I call when my platform has an update for a switch/sensor/etc.?
Well all of deconz different platforms keep a common base, so that should really help you identify these kinds of things.
Updating an entity:
This will read state and a lot of other properties of the entity, so make sure to have them updated before calling self.async_schedule_update_ha_state()
Feel free to use this thread to ask dev questions, or pm me on discord
Thank you for all the help! I really appreciate it!
So I should have the callback from my library call my own internal function to change the entity’s state and then call async_schedule_update_ha_state()?
It looks like deconz adds sensors, etc. by querying the gateway. How would I do this by simply looking for a config entry where the platform is set to my domain and some other attributes?
I’m making an async firmata component from scratch using the newer pymata_aio. It makes much more sense to define arduino pins/i2c devices/etc in the config than attempt autodiscover what could be 30 unused pins. The current firmata/arduino component doesn’t support the full capabilities of digital and analog io. Also, each pin has to be put in a mode, so that really wouldn’t work well.
Maybe you shouldn’t bother with config entries yet if you need a lot of advanced configuration then that will not be acceptable for config entries. Unless you more or less load all in a dynamic way.
The way an arduino works—you have to configure each pin. How else would I do that? That is how the current arduino component works. I’m sure the Raspberry Pi GPIO component would work the same way. I could detect how many analog and digital pins a device has, but that is about it. I still have to tell those pins to listen and what mode to listen in. Firmata doesn’t remember states.
This is very similar to what I am trying to do. What is the limitation? Do async components not allow config via configuration.yaml outside the base of the component? Is it assumed that all async components are self-discovering?
Config entry is when you initiate the integration from the front end. If that is what youre meaning then the configuration.yaml is the way and you will be just fine
Scrolled up… Sorry missread your comment about config entry.