SmartWeather - Get local weather data combined with AI powered Forecast

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

In order to use this component you MUST apply a station_id, as described in the documentation.
[https://github.com/briis/smartweather]

smartweather:
  station_id: <your station id>
  api_key: <Your WeatherFlow API Key>

Hi
I got both APY key, one for smartweather and another for DarkSKY.
For smartweather I got the correct data…

temperature: 25.7
humidity: 94
dewpoint: 24.7
feels_like: 25.7
ozone: 287.1
precipitation: 0.0
precipitation_rate: 0.0
pressure: 1011.7
wind_bearing: 74
wind_speed: 0
wind_gust: 1.4
wind_lull: 0
visibility: 15.524
attribution: Powered by Dark Sky and SmartWeather Weather Station

but for DarkSky data I am not able to get, I only optain:

forecast: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
friendly_name: smartweather

So you get all the data - great - Sorry then I misunderstood your question.
What you are getting back in the forecast attribute, is a data array, and this will only work with the standard Lovelace Weather Card or one of the many Custom Weather Cards you can find in this forum.

Thanks buddy, let me check

How can I install this using HACS?? I keep getting : briis/smartweather/ is not a valid format. Correct format is ‘https://github.com/DEVELOPER/REPOSITORY’ or ‘DEVELOPER/REPOSITORY’.

I have tried to follow the instructions on the HACS developer site, but I get the same result as you. So currently I don’t have a solution. When I have time I will look in to this again.

1 Like

Since my upgrade today to 102.2, SmartWeather isn’t working any more.
Following errors in the log :

2019-11-27 12:54:13 ERROR (MainThread) [homeassistant.setup] Error during setup of component smartweather
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 176, 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/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/smartweather/__init__.py", line 121, in update
    self.data = weather.currentdata()
  File "/usr/local/lib/python3.7/site-packages/pysmartweatherio/models.py", line 44, in currentdata
    feels_like = self.json['obs'][0]['feels_like']
KeyError: 'feels_like'
2019-11-27 12:54:13 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform smartweather.weather: Unable to set up component.
2019-11-27 12:54:13 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform smartweather.binary_sensor: Unable to set up component.
2019-11-27 12:54:13 INFO (MainThread) [homeassistant.setup] Setup of domain weather took 5.3 seconds.

What can be wrong ? Config unchanged.