SmartWeather - Get local weather data combined with AI powered Forecast

You have issues after the upgrade ?

Hi Geert,
I have no issues. I am running latest version of HA and SmartWeather.
I can see it fails on the feels_like temperature variable. This is a calculated value that require both the SKY and AIR module to be present. Was one of the units not working or out of battery?
I assume you have tried to restart HA again?

I will have to add more error checking, to avoid that it will not load because of this. Will do this as soon as I have time.

I am ā€˜In between housesā€™ right now, so I am not actively using the sensors, I have to unpack them to check and develop.

Hello,

I am now getting the following errors as well. Any suggestions?

Sun Dec 01 2019 23:12:22 GMT-0600 (CST)

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 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

What may have changed here?

Hi,
Seems like the datestamp we get is not formatted the way it is expected. Could you give me your StationID then I can try and see if I get the same error. (assuming it is setup as a Public Station)

It looks like you are right. I was using ā€˜4021ā€™, but just changed to another nearby and it is now working,

Thanks!

1 Like

Hi Bjarne,
reloaded the server today and everything is working, no errors.
I am using a solar panel for the SKY, so it might be the module had not enough power last time, and as such was not reachable. Iā€™ll keep an eye on it in the future.
Thanks for the support and the great integration !

Hi Geert,
Glad that it was such an easy fix. Here in Denmark we also had the wettest November ever, so NO Sun for almost a month, and a friend of mine also ran out of power on his Solar Powered SKY unit. Seems like this SOLAR unit was developed in a location were there is more daylight and more sun all year round :grinning:

Bjarne

Hi Bjarne,
again the same problems, meanwhile they have send me a new solar panel, but it seems it was not designed for the dark weatherā€¦

2019-12-23 16:41:15 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'

Wouldnā€™t it be possible in the code to skip certain ā€˜variablesā€™ if they are not available ? Because now we loose the whole weather component.
Iā€™m not a programmer, so maybe it isnā€™t possibleā€¦

Hi Geert,
I will look in to skipping certain sensors if either unit is not available. Stay tuned till after the holidays.

Thanks Bjarne,
this would be great.
Happy holidays !

GitHub release
Hello all,
I spend some time yesterday to rewrite parts of this Integration, and I have just released a new version, with the following changes:

  • Bumped pysmartweatherio to V0.2.3. This version has had a big overhaul and contains much better error handling in the case that one or both of the Devices attached are not working. Sensors will still be created, but just with 0 values. And once the Device is back online, it will start showing data, without you having to restart Home Assistant.
  • Added 2 new sensors:
    • precip_minutes_local_day - Number of minutes it has been raining for the current day
    • precip_minutes_local_yesterday - Number of minutes it has been raining yesterday

I believe this will fix the issues that some have seen during startup.

Installation

  • If you have installed it using HACS, just wait a little bit and the update should show up automatically.
  • If you did a manuel install copy all the files from the Github Repository to the custom_components/smartweather directory in your Home Assistant config.

Let med know if you have any issues.

Happy holidays,
Bjarne

Many thanks Bjarne !
I upgraded yesterday (HACS) and everything seems to be working. Iā€™ll keep you informed.
Happy holidays !

1 Like

Bjarne, i have something strange.
SmartWeather is installed via HACS, the actual version i have is 1.0.1.
It seems i canā€™t upgrade to 1.0.3: After the update it asks for a restart, but after the restart i am again on versions 1.0.1
No idea whyā€¦

Hi Geert,
Recently I noticed some problems with HACS and updating. I have found that if you Uninstall the component, and then re-install, that normally fixes the problem. Could you try that?

Indeed Bjarne, problem solved !
Many thanks.

V2 released

BREAKING CHANGE - read the upgrade instructions below before installing

This is a total rewrite of this component. It introduces a couple of major changes:

  • The component is converted to an Integration, that uses the Integration Page in HA to setup and configure. So no more YAML editing
  • It removes the dependency on DarkSky, and is now using the Forecast data that was introduced by Weatherflow a few month ago. Thanks to @max-rousseau for doing the initial work on this
  • There is support for both the new Tempest Devices and the AIR and SKY devices

Please see the README.md for full instructions on how to set this up or upgrade.

Upgrading from a previous version

The integration has been rewritten, to use Config Flow as configuration option, so if you have a previous version installed, you must first remove that.

So when upgrading do the following in this order:

  1. Edit the yaml files that contain references to smartweather and remove them from the file. (configuration.yaml and were ever you store sensor, binary_sensor and weather configuration)
  2. Remove the Integration from HACS
  3. Restart Home Assistant
  4. When HA is back online go to HACS and install the new Beta Version of SmartWeather
  5. Restart Home Assistant
  6. When HA is back online, go to Configuration and then Integrations, click the + sign in the bottom right, and search for SmartWeather.
  7. Fill out the Configuration Options, and click Submit. You should now have all the Devices and Entities configured.

Hi Bjarne, Iā€™ve been using Smartweather ever since you first introduced it to me via this component. However I donā€™t have a weather station and nor do I have any public ones especially close to me.

I do however have ring of available stations around my area and I have a great deal of success using the REST api to get info from this ā€˜ringā€™ of five stations and taking an average. This also allows for redundancy as a couple of them go offline with some regularity.

I am particularly interested in the accumulated rainfall figures as I have found nowhere else to get this information with anything like as much accuracy as Smartweather.

So to get to my point, does this integration allow for more than one station and does it report rainfall details?

The two fields I use are:

obs[0].precip_accum_local_day and
obs[0].precip_accum_local_yesterday


I also use obs[0].brightness for controlling my house lights.

Hi @klogg
Glad it is useful to you.

Yes, you can add as many stations you want, just click the + in the bottom right corner again, and search for SmartWeather, then add a new station ID. There is not a documented threshold for using the Developer API Key, but I would recommend that you donā€™t add too many stations or at least adjust the update interval, if you add many stations.
The sensors will get _2 added to the end of the entity_id for station number 2, and so on.

For the Rainfall data, here is what I retrieve, and both of your Data Points are in here:

    @property
    def precip_accum_last_1hr(self) -> float:
        """Return Precipition for the Last Hour."""
        return self._precip_accum_last_1hr
        
    @property
    def precip_accum_local_day(self) -> float:
        """Return Precipition for the Day."""
        return self._precip_accum_local_day
        
    @property
    def precip_accum_local_yesterday(self) -> float:
        """Return Precipition for Yesterday."""
        return self._precip_accum_local_yesterday

    @property
    def precip_rate(self) -> float:
        """Return current precipitaion rate."""
        return self._precip_rate
        
    @property
    def precip_minutes_local_day(self) -> int:
        """Return Precipition Minutes Today."""
        return self._precip_minutes_local_day
        
    @property
    def precip_minutes_local_yesterday(self) -> int:
        """Return Precipition Minutes Yesterday."""
        return self._precip_minutes_local_yesterday

And yes, Brightness data is also available in a sensor.

1 Like

Just a heads up as I am not sure if you are still following their forum @briis, but they are working on changing the API/OAuth2/Token mechanism for the backend, so donā€™t be surprised if the developer key does stop working at some point.

Also note the forecasting API is not official, finalised or released, so that may also break at any time.

Thanks for the info Dave,
And yes I am following their forum, and had seen the announcements. I actually made a personal Access Token using the new setup, and that key works with the current implementation. But I am aware that one day, everything might stop working. If you, or anyone else hears something, please post it here.

And as I also stated in the README, I know the Forecast API is experimental, and as such it might break. Again, I hope people will inform this forum if/when that happens, so that the changes can be made.

Again, thanks for the info.

1 Like