briis / smartweather

WeatherFlow Smart Weather Component for Home Assistant
MIT License
108 stars 11 forks source link

Multiple Instances How? #51

Closed tombondee closed 3 years ago

tombondee commented 3 years ago

If I have multiple weather flow tempest stations I see no way to create multiple instances using this component. Would like to have the ability to create multiple instances.

briis commented 3 years ago

If you have have different Station Id's, just add the Integration one more time, and specify the new Station ID. You can repeat this for all Station ID's

yolani commented 3 years ago

Wouk it be possible to enable multiple instances for the same id, currently this does not seem to work.

I was trying to do so in order to get access to daily AND hourly forecasts for the same station.

briis commented 3 years ago

There is a similar request in #53. I will have a look on how this could be done properly.

tombondee commented 3 years ago

Hi,

   If you use the 'custom:weather-card' to contains the forecast data you can create a duplicate and set the features you want for daily or hourly,  etc...

example:

type: 'custom:weather-card' entity: weather.smartweather_home_at_honeoye_falls number_of_forecasts: '5' name: Home current: true details: true forecast: true hourly_forecast: false

type: 'custom:weather-card' entity: weather.smartweather_home_at_honeoye_falls number_of_forecasts: '5' name: Home current: true details: true forecast: true hourly_forecast: true

You can also click on the hour of the card and you will see the daily forecasts if you don't want to use 2 cards.

    Tom

On 1/28/21 12:40 AM, yolani wrote:

Wouk it be possible to enable multiple instances for the same id, currently this does not seem to work.

I was trying to do so in order to get access to daily AND hourly forecasts for the same station.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/briis/smartweather/issues/51#issuecomment-768813257, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNLNM65RBHKDIELDQY7EITS4D2DPANCNFSM4V4QMI2A.

-- TOM BOND Vice President, Technology 14 Old French Road Honeoye Falls, NY 14472 Phone: 585-869-9243 Mobile: 585-662-8956 Email: tom.bond@entexpinc.com

Corporate Headquarters Entertainment Experience LLC 9475 Double R Blvd. Suite 9 Reno, Nevada 89521 Websites: www.eecolor.com

briis commented 3 years ago

I believe I have something useful now. If you go to this Branch and download the following 3 files:

config_flow.py
__init__.py
entity.py

and then replace the files in your custom_components/smartweather directory in HA. Then restart HA and try and add the same station again, just with a different forecast type. I recommend you do not add the sensors on the second instance, as you will just get the same sensors twice. It can be done without errors, but it will just create 34 sensors, you do not need, as they are already present.

The Device will now be named STATION_NAME (FORECAST_TYPE) so in my case Vindinge (Daily) or Vindinge (Hourly). But please note that station already setup, will not be renamed unless you remove it and re-add it. It should still work though, but that is part of this test.

Let me know how this goes.

yolani commented 3 years ago

I'd say it's working, no warnings or errors in the log files either.

Bildschirmfoto 2021-01-28 um 12 52 44 Bildschirmfoto 2021-01-28 um 13 14 33
briis commented 3 years ago

Sehr gut, danke. I will wait for the user who reported this, to see if he is also happy with result, and then I will release it. Thanks for the quick reply.

yolani commented 3 years ago

I am not 100% if this is related, but it's the first time i am seeing any log entries regarding your integration, all 3 of them just happened this morning:

Logger: homeassistant Source: custom_components/smartweather/binary_sensor.py:103 First occurred: 8:18:22 (6 occurrences) Last logged: 8:20:13 Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval await self.async_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh update_callback() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state sstate = self.state File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 158, in state return STATE_ON if self.is_on else STATE_OFF File "/config/custom_components/smartweather/binary_sensor.py", line 103, in is_on return getattr(self.coordinator.data[0], self._sensor) is True IndexError: list index out of range

###################################

Logger: homeassistant Source: custom_components/smartweather/sensor.py:263 First occurred: 8:18:43 (4 occurrences) Last logged: 8:20:13 Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _update_entity_states await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 283, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state sstate = self.state File "/config/custom_components/smartweather/sensor.py", line 263, in state value = getattr(self.coordinator.data[0], self._sensor, None) IndexError: list index out of range

###################################

Logger: homeassistant Source: custom_components/smartweather/entity.py:50 First occurred: 8:18:11 (10 occurrences) Last logged: 8:20:13 Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval await self.async_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh update_callback() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 144, in state_attributes if self.temperature is not None: File "/config/custom_components/smartweather/weather.py", line 111, in temperature if self._current is not None: File "/config/custom_components/smartweather/entity.py", line 50, in _current return self.coordinator.data[0] IndexError: list index out of range

briis commented 3 years ago

The IndexError: list index out of range means we did not get any data. Could you check the Tempest APP, and also let me know if this continues? If it works again on the next update, it is most likely just a bad set of data retrieved from WeatherFlow

yolani commented 3 years ago

What exactly do you mean by "check the tempest app"?

If I look at the historical data, it indeed seems to stop at the time of the error: image

briis commented 3 years ago

Yes, sorry. I just meant to check the Tempest App to see if this is updating - The wind sensor updates every 3 seconds, so if this is updating then your system is running. Just a check to see if everything was OK. Again. let me know if this error continues to show, or it was a one-off.

yolani commented 3 years ago

Seems like a one-off I guess, did not appear again in the last 4 hours. Probably unavoidable if you use an external API.

briis commented 3 years ago

I have released v2.2.2 that includes this, so I will close this issue.