kingsleyadam / local-abbfreeathome

A Python Package for interacting with the ABB (Busch Jaeger) Free@Home System via the Local API
MIT License
4 stars 2 forks source link

AttributeError: 'NoneType' object has no attribute 'get' #13

Closed derjoerg closed 1 month ago

derjoerg commented 1 month ago

Hi,

I just wanted to start to test your new package and have encountered the following:

And for sure, I have several devices with FunctionID=7

kingsleyadam commented 1 month ago

I'll take a look, what's most likely happening is the device isn't in a room. I've set a default room for this scenario but the code obviously isn't using it.

derjoerg commented 1 month ago

Yep,

I also just checked the code and my setup and I have one switch-channel in an device, which is not associated to a room (and so you can leave these out as only channels, which are associated to a room can be controlled in F@H)

kingsleyadam commented 1 month ago

I just pushed a fix to a new branch, could try that branch to see if that does it?

git checkout -b u/kingsleyadam/fixNoRoomFloor

I'm going to adjust the unit test to test this scenario.

derjoerg commented 1 month ago

This works, but it returns the unassigned channel. This might be ok for this library but for the HA-integration such channels need to be omitted. Perhaps by adding an optional parameter to "load_devices" (which will be passed to "_load_switches")? e.g. something like "omitUnassociated" which defaults to false and returns everything and especially the HA-integration sets this parameter to "true"

oh, I just saw that such a parameter would also needs to be passed to "get_devices_by_function"

kingsleyadam commented 1 month ago

What would be the issue with including unassociated channels into Home Assistant? Just curious if this would actually be problematic, or just a possible inconvenience? We don't have to use all entities added to HA, but it would give other users the ability to use a channel even if it's not associated with a floor plan.

derjoerg commented 1 month ago

I'm absolutely with you that it wouldn't harm anybody if these channels are also added to HA. I was just under the impression, as such channels are not useable in the F@H app, they are also not useable through the API and so are totally useless in HA. But this is only my impression, I never tested it.

kingsleyadam commented 1 month ago

I'm absolutely with you that it wouldn't harm anybody if these channels are also added to HA. I was just under the impression, as such channels are not useable in the F@H app, they are also not useable through the API and so are totally useless in HA. But this is only my impression, I never tested it.

@derjoerg , Do you mind sharing the device config that triggered this for you? Anything with the FID_SWITCH_ACTUATOR function should be a usable/switchable device.

Unless maybe it's using a different interface I haven't seen before. That's one thing I do need to add, the ability to filter devices by interface so we don't get things like Philips Hue devices in Home Assistant.

I wish ABB would publish a list of known possible interfaces.

kingsleyadam commented 1 month ago

Also a heads up @derjoerg, I did merge this into the main branch and I've updated the Home Assistant Integration to include this fix in case you wanted to test how the integration would pull the devices into HA. https://github.com/kingsleyadam/local-abbfreeathome-hass/releases/tag/0.4.1

derjoerg commented 1 month ago

I'm absolutely with you that it wouldn't harm anybody if these channels are also added to HA. I was just under the impression, as such channels are not useable in the F@H app, they are also not useable through the API and so are totally useless in HA. But this is only my impression, I never tested it.

@derjoerg , Do you mind sharing the device config that triggered this for you? Anything with the FID_SWITCH_ACTUATOR function should be a usable/switchable device.

Unless maybe it's using a different interface I haven't seen before. That's one thing I do need to add, the ability to filter devices by interface so we don't get things like Philips Hue devices in Home Assistant.

I wish ABB would publish a list of known possible interfaces.

I just checked the new HA-integration and even that a channel isn't useable within the F@H-app I can control it through HA and API, so all good to have it included in HA

derjoerg commented 1 month ago

Also a heads up @derjoerg, I did merge this into the main branch and I've updated the Home Assistant Integration to include this fix in case you wanted to test how the integration would pull the devices into HA. https://github.com/kingsleyadam/local-abbfreeathome-hass/releases/tag/0.4.1

Works like a charme.

Do you might think it is meaningful to open "Discussions" here and for your HA-integration? Or should all questions and/or discussions open as issues?

kingsleyadam commented 1 month ago

Good idea, I’ve enabled discussions on the repository.