SmartWeather - Get local weather data combined with AI powered Forecast

Hi Lorenzo,
It seems like you only have the AIR Module installed, as no Wind Readings are returned. Is that true?
I will try and do better error handling, so that you can load the module, even without a SKY module. Then there will just be a lot of zero values.

EDIT: There is now a new release that should work even if you don’t have either the SKY or AIR unit installed. Update through Customer Updater or download __init__.py

thanks a lot will try as i get back home

EDIT WORKS THANKS!!!

Hi,
thanks for the help, how to I change the unit for the wind from m/s to km/h? Any ETA for the UDP based version ?

thanks

I am assuming your are refering to the Sensor component, as the Weather Component does return Wind in km/h (As per default for this type of Component)
When your Home Assistant Unit System is Metric, it will always return the Wind Speeds in m/s. For now the only way to get this in km/h is by creating a template sensor where you convert the value. I will look in to having the option of converting to km/h build in to the component.

I have the Sensor component running via UDP on a test system for a few weeks now, I just need to find the time to package it all nicely together so that others can test it too.Hopefully during the Easter period I will find the time to do it.

1 Like

That was more or less where I got to, before I gave up. In the end I went with a UDP Listener helper, which published to MQTT and just picked it up in HA. Wasn’t what I wanted to do, but I really could not make head nor tail of how to proceed with a full custom component (nor if it should be sensors with attributes, platforms with sensors or any of the other combinations!).

Glad to see someone else working on it, I hope you have more luck :+1:

There is now a UDP version available for test. Look in this entry and please post questions to the UDP version in there. WeatherFlow Smart Weather Station via UDP

@Lorenzo_Gulli: There is now a new version that supports km/h as Wind Unit, when using the Metric Unit System in Home assistant. Download the sensor.py file or update via Custom Updater. See the README.md on Github, for setup instructions.

Thanks @briss this is fantastic! :grinning:

1 Like

Hey fellas!

Really enjoying the component so far - had an issue crop up through where all of a sudden after working fine, a restart has the smartweather component failing with the following log popping up in Hass:

019-05-13 19:38:56 ERROR (MainThread) [homeassistant.setup] Error during setup of component smartweather
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/smartweather/__init__.py", line 94, in setup
    data.update()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/smartweather/__init__.py", line 121, in update
    self.data = weather.currentdata()
  File "/config/deps/lib/python3.7/site-packages/pysmartweatherio/models.py", line 25, in currentdata
    dtformat = datetime.datetime.fromtimestamp(self.json['obs'][0]['timestamp']).strftime('%Y-%m-%d %H:%M:%S')
IndexError: list index out of range

Has anyone seen this before, have already checked to make sure the files are up to date, but no luck there.

UPDATE: Turns out the station I was using was no longer available (no recent observation) - switching to an alternate corrected the problem!

This is a great component but today I have some weirdness.

About an hour ago I stopped getting any light based info. Other monitored conditions still work so the station is still on line and looking on the website the figures I want are still being measured.

Any idea what is going on?

I’ve done all the usual checks like restart HA and there is no mention of Smartweather in my logs.

  #==========================
  #=== Smart Weather sensors
  #==========================
  - platform: smartweather
    monitored_conditions:
      - temperature
#      - feels_like_temperature
#      - heat_index
#      - wind_chill
#      - dewpoint
#      - wind_speed
#      - wind_gust
#      - wind_bearing
#      - wind_direction
      - precipitation
      - precipitation_rate
      - precipitation_last_1hr
      - precipitation_last_24hr
      - precipitation_yesterday
#      - humidity
#      - pressure
      - uv
      - solar_radiation
      - illuminance
    scan_interval:
      minutes: 10

From the Smart Weather website:

Showing when it stopped working.
image

HA dev tools
image
image

On vacation right now. Will look at when I am back in a week

That seems like a reasonable excuse :wink:
Thanks and have a great time!

Sorry for the long delay. I moved house when getting back from vacation, so the delay was a bit a longer:grinning: Do you still have the problem? If yes, what is the Station ID you are using?

Thanks but no I don’t, strangely enough it came back all by itself a couple of days ago.
Very strange.

I’ll let you know if it happens again.

briis, I had an error occur today - no changes on my end to HA. Here are the logs:

Error during setup of component smartweather    

Traceback (most recent call last):
      File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
        component.setup, hass, processed_config)  # type: ignore
      File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
        yield self  # This tells Task to wait for completion.
      File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
        future.result()
      File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
        raise self._exception
      File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/home/homeassistant/.homeassistant/custom_components/smartweather/__init__.py", line 94, in setup
        data.update()
      File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 224, in wrapper
        result = method(*args, **kwargs)
      File "/home/homeassistant/.homeassistant/custom_components/smartweather/__init__.py", line 121, in update
        self.data = weather.currentdata()
      File "/srv/homeassistant/lib/python3.5/site-packages/pysmartweatherio/models.py", line 61, in currentdata
        Conversion.volume(float(self.json['obs'][0]['precip_accum_last_24hr']), self.units),
    KeyError: 'precip_accum_last_24hr'

I haven’t investigated much, but this is probably the kick I need to finally move over to your other plugin which avoids the cloud altogether - although this error means the Darksky forceasting component is also broken. But anyway, would it have anything to do with this?

I just found that out also. I am working on an update to remove the precip_accum_last_24hr from the calls as a quick fix. I will add the new values as soon as possible.

Cheers mate! :slight_smile:

The problem should now be fixed, and a new version is available on Github. A breaking change is that the sensor precipitation_24_hr does no longer exist.

I also made some changes on how Custom_Updater is working, so that you will only have 1 entry in the Tracker Card going forward. So if Custom_Updater does nor work, please delete all files in the SmartWeather folder and re-download from Github.

1 Like

Thanks Bjarne, all working again - this is a great component.

Hi
I am trying to use this component without a ‘Smart Weather Station’, I only want to use:
weather:

  • platform: smartweather
    api_key:

Any idea or suggestion to check for this error in HASSIO?

from log: 2019-08-14 16:00:23 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform smartweather.weather: Unable to set up component.

Invalid config

The following components and platforms could not be set up:

Please check your config.

my configuration.YAML
weather:

  • platform: smartweather
    api_key: MYKEY
    mode: daily