#tplink
1 messages ยท Page 1 of 1 (latest)
Hi @vapid roost, so before you added the fisrt device with the IP you didn't see any devices? Was this on the overview page or if you click in to the integration itself?
Exactly. I just removed all devices again and restarted HA. Nothing shows up as discovered in the integrations dashboard. (Can't click into the integration itself if it wasn't set up before.) I manually added a device again and the remaining ones show up
If you do "Add integration" > "TPLink Kasa Smart" and leave host empty does it find them all?
Yes it does, I did not expect I could leave the field empty (will learn me to read next time).
Still makes me wonder why it discovers them when I start the flow,
but not automatically like other devices in HA.
Here is the diagnostics I downloaded after setting up.
I think it's because once you've added one then the integrations discovery starts to kick in. Before that it's using the list of know mac address prefixes via dhcp
Would you mind generating some fixtures via the python-kasa devtools?
Doing so as we speak.
Just the entire files for all 4?
They seem to be mostly the same, except for the MAC address.
That's great, thanks very much!
Maybe we could improve the config flow UX by adding a menu as the first step, allowing to select automatic discovery or manual entry?
The text mentions that devices are automatically discovered if no address is given, but having a menu would make it nicer ๐
That would improve it, but ideally it uses the native things?
Hmm, what do you mean by native things in this context? The standard config flow elements? If so, there's self.async_show_menu which is widely used inside homeassistant to do something like this. Probably not worth changing during the beta, but just something to keep in mind for future improvements.
https://github.com/home-assistant/core/blob/0c3541c194b09d6deea02691756d673916c25139/homeassistant/components/risco/config_flow.py#L131 something like this, but in our case the menu_options would be discovery and manual. The menu texts can be adjusted to our liking, too: https://github.com/home-assistant/core/blob/0c3541c194b09d6deea02691756d673916c25139/homeassistant/components/risco/strings.json#L4
I just mean, why do we need to manually start the flow for devices to get discovered? Normally they all show up in HA with an option to configure, even when the integration was not set up before.
I think that this might be a bug, too. As after adding a single device it will immediately show all discovered devices on the page, but it doesn't do that if you click cancel on the dialog ๐ฆ
Ahh, that one. So when the integration has not yet been set up, the discovery is based on MAC addresses. We haven't yet updated the list in manifest.json to contain all currently known ones, but we should do that before the release.
Thanks for those files, they will help us to get more devices autodetected out of the box!
Indeed, there are more that could be discovered looking at the library as well.
I expected at least 1 to show up, P115EU_1.0_1.3.0_-_50 would match with
{
"hostname": "p1*",
"macaddress": "30DE4B*"
},
``` (line 191-194 in the manifest).
"macaddress": "3C52A1*" would match my P115 as well (currently limited to hostname e[sp]* and l5*.
"macaddress": "5091E3*" is in there as well but currently only hostname k[lps]*
I'm not an active HA developer but just wondering, do we always need to have both a hostname and macaddress?
We could indeed be more lax on those filters, but having a partial hostname will avoid false positives given that tplink manufactures a lot of network equipment and other devices we don't currently support.
Added the macs from your fixture files to https://github.com/python-kasa/python-kasa/pull/677 - in the end we want to have a database with enough information to automatically generate the information for manifest to avoid manually maintaining it ๐
I think we could use a simple wildcard like *<any 2-digit+ number>* to match, to avoid overly complicating the matter. I'll sync the known addresses to see how it would look like
@vapid roost your devices should be discovered automatically starting from the next beta release: https://github.com/home-assistant/core/pull/109437/ - thanks again for those fixture files! edit: oh, 2024.2.0b4 which contains that PR was released just a few minutes ago.