Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding some instructions #2

Closed
MichaelNMaggs opened this issue May 22, 2021 · 16 comments
Closed

Adding some instructions #2

MichaelNMaggs opened this issue May 22, 2021 · 16 comments

Comments

@MichaelNMaggs
Copy link

MichaelNMaggs commented May 22, 2021

Hi, just across this repo when it was mentioned yesterday in this thread: https://community.home-assistant.io/t/davis-weatherlink-integration/134737/25. It looks very good, and I'd like to try it out, but I'm not very experienced and am struggling without instructions. Have managed to add the integration and can see the device plus lots of entities, but they are all 'unavailable'. Can you help me complete the setup, please?

I and I'm sure others would appreciate it if you had time to add some setup instructions and perhaps an option or two for sample frequency, units, rain cup size etc

@siku2
Copy link
Owner

siku2 commented May 22, 2021

Is there anything suspicious in the logs? I haven't tested this integration outside of my own environment and Davis' documentation is rather sparse so it's quite likely that there are still some issues to work out.

@MichaelNMaggs
Copy link
Author

This is what the log shows:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 375, in _async_write_ha_state
extra_state_attributes = self.device_state_attributes
File "/config/custom_components/weatherlink/sensor_iss.py", line 90, in device_state_attributes
"wind_chill": round(c.wind_chill, DECIMALS_TEMPERATURE),
TypeError: type NoneType doesn't define round method
2021-05-22 12:41:03 ERROR (MainThread) [homeassistant.components.weather] Error adding entities for domain weather with platform weatherlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 340, in _stringify_state
state = self.state
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 206, in state
return self.condition
File "/config/custom_components/weatherlink/weather.py", line 76, in condition
if c.wind_speed_avg_last_2_min > 20:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
2021-05-22 12:41:03 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up weatherlink platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 239, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 375, in _async_write_ha_state
extra_state_attributes = self.device_state_attributes
File "/config/custom_components/weatherlink/sensor_iss.py", line 90, in device_state_attributes
"wind_chill": round(c.wind_chill, DECIMALS_TEMPERATURE),
TypeError: type NoneType doesn't define round method
2021-05-22 12:41:03 ERROR (MainThread) [homeassistant.components.weather] Error while setting up weatherlink platform for weather
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 239, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 340, in _stringify_state
state = self.state
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 206, in state
return self.condition
File "/config/custom_components/weatherlink/weather.py", line 76, in condition
if c.wind_speed_avg_last_2_min > 20:

@siku2
Copy link
Owner

siku2 commented May 22, 2021

Ah right, that's what I expected... You see, the documentation doesn't specify whether certain values are optional or not so I just had to guess.
Turns out wind_chill can be null :P

@siku2
Copy link
Owner

siku2 commented May 22, 2021

If you would, could you please send me the JSON payload from

http://<your weatherlink live host>/v1/current_conditions

That way I can compare it against my current knowledge and hopefully fix other issues like this pre-emptively.

@MichaelNMaggs
Copy link
Author

Sure, here it is. In case it's not clear, I have the main ISS on channel 1 and a separate anemometer reporting on channel 2. I'm in the UK, so using metric raincup size, and working in degrees C. But some of the returned values look odd - for example the temperature appears to be in degrees F.

{"data":{"did":"001D0A71472B","ts":1621686244,"conditions":[{"lsid":418773,"data_structure_type":1,"txid":1,"temp": 52.1,"hum":59.1,"dew_point": 38.2,"wet_bulb": 43.9,"heat_index": 51.1,"wind_chill":null,"thw_index":null,"thsw_index":null,"wind_speed_last":null,"wind_dir_last":null,"wind_speed_avg_last_1_min":null,"wind_dir_scalar_avg_last_1_min":null,"wind_speed_avg_last_2_min":null,"wind_dir_scalar_avg_last_2_min":null,"wind_speed_hi_last_2_min":null,"wind_dir_at_hi_speed_last_2_min":null,"wind_speed_avg_last_10_min":null,"wind_dir_scalar_avg_last_10_min":null,"wind_speed_hi_last_10_min":null,"wind_dir_at_hi_speed_last_10_min":null,"rain_size":2,"rain_rate_last":0,"rain_rate_hi":0,"rainfall_last_15_min":0,"rain_rate_hi_last_15_min":0,"rainfall_last_60_min":0,"rainfall_last_24_hr":54,"rain_storm":213,"rain_storm_start_at":1621054081,"solar_rad":283,"uv_index":null,"rx_state":0,"trans_battery_flag":0,"rainfall_daily":30,"rainfall_monthly":251,"rainfall_year":251,"rain_storm_last":38,"rain_storm_last_start_at":1620901021,"rain_storm_last_end_at":1621044061},{"lsid":418774,"data_structure_type":1,"txid":2,"temp":null,"hum":null,"dew_point":null,"wet_bulb":null,"heat_index":null,"wind_chill":null,"thw_index":null,"thsw_index":null,"wind_speed_last":3.00,"wind_dir_last":252,"wind_speed_avg_last_1_min":1.18,"wind_dir_scalar_avg_last_1_min":251,"wind_speed_avg_last_2_min":1.00,"wind_dir_scalar_avg_last_2_min":251,"wind_speed_hi_last_2_min":4.00,"wind_dir_at_hi_speed_last_2_min":250,"wind_speed_avg_last_10_min":2.56,"wind_dir_scalar_avg_last_10_min":254,"wind_speed_hi_last_10_min":10.00,"wind_dir_at_hi_speed_last_10_min":266,"rain_size":1,"rain_rate_last":0,"rain_rate_hi":0,"rainfall_last_15_min":0,"rain_rate_hi_last_15_min":0,"rainfall_last_60_min":0,"rainfall_last_24_hr":0,"rain_storm":null,"rain_storm_start_at":null,"solar_rad":null,"uv_index":null,"rx_state":0,"trans_battery_flag":0,"rainfall_daily":0,"rainfall_monthly":0,"rainfall_year":0,"rain_storm_last":null,"rain_storm_last_start_at":null,"rain_storm_last_end_at":null},{"lsid":418764,"data_structure_type":4,"temp_in": 74.4,"hum_in":41.0,"dew_point_in": 49.2,"heat_index_in": 73.5},{"lsid":418763,"data_structure_type":3,"bar_sea_level":29.660,"bar_trend": 0.054,"bar_absolute":29.259}]},"error":null}

@siku2
Copy link
Owner

siku2 commented May 22, 2021

But some of the returned values look odd - for example the temperature appears to be in degrees F.

Yeah, the weatherlink live station always uses its own units regardless of what you set (the only exception is the rain stuff which is reported in cup counts)


Anyway, thanks a lot for this! I learned some new things about the API from looking at this. Turns out it's is even more janky than I expected.
In your case it returns two data structures for the ISS and the one containing the anemometer also reports rain data for some reason (although all the values are 0)...
I added some handling for this in 5e595b6 but it's not ideal and might require more changes.

@MichaelNMaggs
Copy link
Author

Many thanks! Can I try that, and report back any issues? Probably tomorrow now

@siku2
Copy link
Owner

siku2 commented May 22, 2021

Yeah, I just released it as v0.2.7.
Let me know how far it gets this time before it inevitably crashes and burns.

@MichaelNMaggs
Copy link
Author

Ok, I quickly reloaded the integration, restarted HA, and got this -

2021-05-22 15:35:27 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform weatherlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 375, in _async_write_ha_state
extra_state_attributes = self.device_state_attributes
File "/config/custom_components/weatherlink/sensor_iss.py", line 90, in device_state_attributes
"wind_chill": round(c.wind_chill, DECIMALS_TEMPERATURE),
TypeError: type NoneType doesn't define round method
2021-05-22 15:35:27 ERROR (MainThread) [homeassistant.components.weather] Error adding entities for domain weather with platform weatherlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 340, in _stringify_state
state = self.state
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 206, in state
return self.condition
File "/config/custom_components/weatherlink/weather.py", line 76, in condition
if c.wind_speed_avg_last_2_min > 20:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
2021-05-22 15:35:27 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up weatherlink platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 239, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 375, in _async_write_ha_state
extra_state_attributes = self.device_state_attributes
File "/config/custom_components/weatherlink/sensor_iss.py", line 90, in device_state_attributes
"wind_chill": round(c.wind_chill, DECIMALS_TEMPERATURE),
TypeError: type NoneType doesn't define round method
2021-05-22 15:35:27 ERROR (MainThread) [homeassistant.components.weather] Error while setting up weatherlink platform for weather
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 239, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 581, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 340, in _stringify_state
state = self.state
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 206, in state
return self.condition
File "/config/custom_components/weatherlink/weather.py", line 76, in condition
if c.wind_speed_avg_last_2_min > 20:
TypeError: '>' not supported between instances of 'NoneType' and 'int'

@siku2
Copy link
Owner

siku2 commented May 22, 2021

That doesn't look like you're running the new version. Are you sure you're running 0.2.7?
You can force HACS to refresh by pressing the "Update Information" button.

@MichaelNMaggs
Copy link
Author

Right, now done. Will dig into the results tomorrow, but it's looking very much better already!
Screenshot 2021-05-22 at 16 09 00

@siku2
Copy link
Owner

siku2 commented May 22, 2021

Great!
As for your other requests, I started working on configurable units over at hass-weatherlink@units which will also include the configurable poll interval.
Let me know if anything else comes up.

@MichaelNMaggs
Copy link
Author

Right, now done. Will dig into the results tomorrow, but it's looking very much better already!
Screenshot 2021-05-22 at 16 09 00

@MichaelNMaggs
Copy link
Author

It's all working perfectly. Thanks so much for working on this, it makes things so much easier!

Happy to check out the unit options once you've done them. Any chance of wind in miles per hour?

@MichaelNMaggs
Copy link
Author

The link to the documenation page (via the three dots on the integration card) isn't right: it points to http://homeassistant.local:8123/config/undefined

@siku2
Copy link
Owner

siku2 commented May 25, 2021

Just released version 0.3 which contains the unit configuration among other things.
I'm closing this because all of the points in here have been addressed, but feel welcome to open a new issue if you run into any issues.

@siku2 siku2 closed this as completed May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants