fbradyirl / openwrt-luci-rpc

Other
34 stars 22 forks source link

Issue 60 #61

Closed Tinigriffy closed 8 months ago

Tinigriffy commented 9 months ago

Fix for Luci device tracker: AttributeError: 'list' object has no attribute 'upper' #60 It seems that openwrt can now send a list or a string and this is not handled. Fix it.

jstrot commented 8 months ago

How about always converting the x['mac'] to a list and then doing mac in string_to_list(x['mac']) ? That way an entry with multiple macs can be matched.

Tinigriffy commented 8 months ago

I did it this way because I did not understood what the structure could return and how the lamba will behave :). I was wondering if it should not be reported as bug to openwrt. From my perspective, I would expect that the api always returns a list. So I took the simplest approach to fix the issue for me :) But I totally agree this is not the most robust way to handle this case. May be something like str(x['mac']).upper().find(mac) could work in all cases.

Tinigriffy commented 8 months ago

... May be something like str(x['mac']).upper().find(mac) could work in all cases.

I tried this new approach on the new HA version 2024.2.0 and it seems to work

mexx42 commented 7 months ago

i think we need a new version number so that it can be included in forthcoming ha releases ... ?

mrchi commented 7 months ago

i think we need a new version number so that it can be included in forthcoming ha releases ... ?

Yes, I've just fixed the test case that caused the CI failure and released version 1.1.17. Feel free to try it out and provide feedback.

mexx42 commented 7 months ago

Thanks, see https://github.com/home-assistant/core/issues/107319#issuecomment-1980547528