Config flow for integration that has only single service - check hardware before set-up

I’ve created a very simple integration (https://github.com/Misiu/argon40) that has only a single service.
The communication with the device is done via I2C, so if the user doesn’t enable it the integration won’t loa (and old versions of HA will crash)

My idea is to add config flow without any input, that will check if I2C is enabled and that will try to communicate with the device (the device has a fixed address). Only if everything will success the integration will be set-up.

My integration is based on https://github.com/custom-components/blueprint.
I try to follow https://github.com/custom-components/blueprint/blob/99b07e5a7ae5dd4e949607b5377afe3128dd2d83/custom_components/blueprint/config_flow.py but as I wrote before, I don’t expect any input from the user, only hardware validation and I2C check.

Id like to ask for a hint or a sample that shows how to create a config flow that doesn’t require any input from the user and that can check is specific conditions are met before the integration is set-up.

I think this is possible.

I’m not an expert on this, but my recent config flow PR does some scanning of what com ports are available before it shows the first user pane (it needs this to decide what to put in the drop-down)

I suppose it would be possible to do some checking then simply display an error or success message as the first pane.

1 Like

thank you for linking your PR.
This is exactly what I’m trying to do :slight_smile:
I’ve built a POC config flow but now I need to test it on a real device.
But belive me, the worst part is enabling I2C on PI4 running HassOS. I can’t find a good instruction on how to do that :confused: