siku2 / hass-weatherlink

Home Assistant integration for Davis Instruments' WeatherLink and AirLink
MIT License
26 stars 7 forks source link

Updates units.py for the new api #32

Closed xdecock closed 1 year ago

xdecock commented 1 year ago

https://github.com/mrk-its/homeassistant-blitzortung/issues/66 as described here.

Should fix #31

NRutt2005 commented 1 year ago

@xdecock will this patch solve the issue that came up in Home Assistant 2023.3.0 as I stated in the hass-weatherlink issues section of this repository and will it be implemented soon?

xdecock commented 1 year ago

Almost need to fix the import also but did this from the web i'll try to do a cleaner patch tomorrow but runs on my home assistant correctly

Le ven. 3 mars 2023, 21:29, NRutt2005 @.***> a écrit :

@xdecock https://github.com/xdecock does this patch solve the issue that came up in Home Assistant 2023.3.0 as I stated in the hass-weatherlink issues section of this repository?

— Reply to this email directly, view it on GitHub https://github.com/siku2/hass-weatherlink/pull/32#issuecomment-1454089600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAME7NKCQF5XZ7YZAWIJMLW2JIA3ANCNFSM6AAAAAAVO6QNW4 . You are receiving this because you were mentioned.Message ID: @.***>

NRutt2005 commented 1 year ago

@xdecock I've tried changing line 213 and now I'm getting the error in my log. Any suggestions? This is the error I get after updating again to 2023.3.x. Thank you for your assistance!

This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/weatherlink/units.py:213 Integration: WeatherLink (documentation, issues) First occurred: 5:49:41 PM (1 occurrences) Last logged: 5:49:41 PM

Error setting up entry WeatherLink 001D0A714D87 for weatherlink Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/weatherlink/init.py", line 165, in async_setup_entry await setup_coordinator(hass, entry) File "/config/custom_components/weatherlink/init.py", line 156, in setup_coordinator coordinator = await WeatherLinkCoordinator.build( File "/config/custom_components/weatherlink/init.py", line 145, in build await coordinator.__initalize(session, entry) File "/config/custom_components/weatherlink/init.py", line 92, in initalize await self.update_config(self.hass, entry) File "/config/custom_components/weatherlink/init.py", line 71, in __update_config self.units = get_unit_config(hass, entry) File "/config/custom_components/weatherlink/units.py", line 213, in get_unit_config if hass.config.units is IMPERIAL_SYSTEM: NameError: name 'IMPERIAL_SYSTEM' is not defined

xdecock commented 1 year ago

Yes top of the file addapt the imported constant

Le lun. 6 mars 2023, 00:55, NRutt2005 @.***> a écrit :

@xdecock https://github.com/xdecock I've tried changing line 213 and now I'm getting the error in my log. Any suggestions? This is the error I get after updating again to 2023.3.x. Thank you for your assistance!

This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/weatherlink/units.py:213 Integration: WeatherLink (documentation, issues) First occurred: 5:49:41 PM (1 occurrences) Last logged: 5:49:41 PM

Error setting up entry WeatherLink 001D0A714D87 for weatherlink Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/weatherlink/init.py", line 165, in async_setup_entry await setup_coordinator(hass, entry) File "/config/custom_components/weatherlink/init.py", line 156, in setup_coordinator coordinator = await WeatherLinkCoordinator.build( File "/config/custom_components/weatherlink/init.py", line 145, in build await coordinator.__initalize(session, entry) File "/config/custom_components/weatherlink/init.py", line 92, in initalize await self.update_config(self.hass, entry) File "/config/custom_components/weatherlink/init.py", line 71, in __update_config self.units = get_unit_config(hass, entry) File "/config/custom_components/weatherlink/units.py", line 213, in get_unit_config if hass.config.units is IMPERIAL_SYSTEM: NameError: name 'IMPERIAL_SYSTEM' is not defined

— Reply to this email directly, view it on GitHub https://github.com/siku2/hass-weatherlink/pull/32#issuecomment-1455250578, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAME7I3XOEN7H226ZM3A4TW2URYHANCNFSM6AAAAAAVO6QNW4 . You are receiving this because you were mentioned.Message ID: @.***>

NRutt2005 commented 1 year ago

Sorry, I'm not following when you say "top of the file addapt the imported constant". Could you explain a little bit further for me? Thank you for your help!

xdecock commented 1 year ago

Sorry, I'm not following when you say "top of the file addapt the imported constant". Could you explain a little bit further for me? Thank you for your help!

I've just updated the mr to make it clearer i hope it works i'm on my phone

NRutt2005 commented 1 year ago

Looks like it's getting closer to working again. The latest error I get now will the two changes. Looks like something in the const.py file needs to be changed? I'm sorry, I'm just good with any sort of coding. I know just enough to get me in trouble as I am in now.

Logger: homeassistant.setup Source: setup.py:213 First occurred: 12:16:04 AM (1 occurrences) Last logged: 12:16:04 AM

Setup failed for custom integration weatherlink: Unable to import component: cannot import name 'IMPERIAL_SYSTEM' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

xdecock commented 1 year ago

Ok, this file is fetch from my home assistant, that's not throwing error anymore, and imperial is now deprecated also, so i took the liberty to update this file.

groetg commented 1 year ago

Can you explained what you have changed? I have changed units.py line 213 into hass.config.units.name is IMPERIAL_SYSTEM: Now I got other errors and is weatherlink addon still not working...

xdecock commented 1 year ago

Check the last version of the file in the merge request running smoothly for days now

Le jeu. 9 mars 2023, 09:13, groetg @.***> a écrit :

Can you explained what you have changed? I have changed units.py line 213 into hass.config.units.name is IMPERIAL_SYSTEM: Now I got other errors and is weatherlink addon still not working...

— Reply to this email directly, view it on GitHub https://github.com/siku2/hass-weatherlink/pull/32#issuecomment-1461531413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAME7LJHAPAMUZGKD743ZDW3GGKJANCNFSM6AAAAAAVO6QNW4 . You are receiving this because you were mentioned.Message ID: @.***>

NRutt2005 commented 1 year ago

@groetg What I did, if I remember correctly, I just copied all 216 lines of code from the Updates unit.py for the new api #32 under "Commits" and clicked in "Update to avoid imperial system being on deprecation list" to see the code. I copied the code and then pasted it in the /config/custom_components/weatherlink/units.py file.

Since doing so, this new code has fixed all my issues. I was hoping that the new code would be pushed out on a release...but I haven't heard from either of the contributors for this repository. I believe one of them has to push it out as a new release. For now, this is the only way I know to make this work.

groetg commented 1 year ago

I changed in home assistant / HACS the repository to the version of xdecock (https://github.com/xdecock/hass-weatherlink) and now the weatherlink is active again! Thanx