jeroenterheerdt / HAsmartirrigation

Smart Irrigation custom component for Home Assistant
MIT License
308 stars 48 forks source link

[Bug] Error adding entities for domain sensor with platform smart_irrigation #144

Closed clau-bucur closed 10 months ago

clau-bucur commented 10 months ago

Describe the bug Upon HA start-up I get the following error:

2023-07-12 03:33:37.271 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform smart_irrigation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 504, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 788, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 557, in state
    self._state = self.update_state()
                  ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 516, in update_state
    self.evapotranspiration = self.get_evapotranspiration(data)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 694, in get_evapotranspiration
    t_dew = float(data["dew_point"])
                  ~~~~^^^^^^^^^^^^^
KeyError: 'dew_point'

To Reproduce Steps to reproduce the behavior:

  1. Upon Home Assistant startup
  2. See error

Expected behavior A clear and concise description of what you expected to happen.

My configuration Using in sensors-only mode, no OWM:

{
  "version": 1,
  "domain": "smart_irrigation",
  "title": "Smart Irrigation",
  "data": {
    "number_of_sprinklers": 6.0,
    "flow": 12.0,
    "area": 135.0,
    "api_key": null,
    "reference_evapotranspiration": [
      0.2,
      0.2,
      2.2,
      2.2,
      2.2,
      3.9,
      5.4,
      3.5,
      0.2,
      0.2,
      0.2,
      0.2
    ],
    "name": "Smart Irrigation",
    "sources": {
      "use_owm_precipitation": false,
      "use_owm_temperature": false,
      "use_owm_min_temperature": false,
      "use_owm_max_temperature": false,
      "use_owm_dewpoint": false,
      "use_owm_pressure": false,
      "use_owm_humidity": false,
      "use_owm_windspeed": false,
      "calculate_solar_radiation": false,
      "calculate_ET_value": true
    },
    "sensors": {
      "sensor_precipitation": "sensor.icorun3_precipitation_today",
      "sensor_temperature": "sensor.weather_outside_temperature",
      "sensor_min_temperature": "sensor.aggregation_temperature_daily_outside_min",
      "sensor_max_temperature": "sensor.aggregation_temperature_daily_outside_max",
      "sensor_dewpoint": "sensor.icorun3_dewpoint",
      "sensor_pressure": "sensor.icorun3_pressure",
      "sensor_humidity": "sensor.weather_outside_humidity",
      "sensor_windspeed": "sensor.icorun3_wind_speed",
      "sensor_solar_radiation": "sensor.icorun3_solar_radiation"
    }
  },
  "options": {},
  "pref_disable_new_entities": false,
  "pref_disable_polling": false,
  "source": "user",
  "unique_id": "Smart Irrigation",
  "disabled_by": null
}

Installed version 0.0.79

jeroenterheerdt commented 10 months ago

You are saying you use your own sensors but the booleans indicating you are using your own sensors (use_own_dewpoint for example) are set to false so of course it is trying to use OWM. Set the booleans to true and you're good.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Claudiu Bucur @.> Sent: Tuesday, July 18, 2023 3:10:25 AM To: jeroenterheerdt/HAsmartirrigation @.> Cc: Assign @.>; Subscribed @.> Subject: [jeroenterheerdt/HAsmartirrigation] [Bug] Error adding entities for domain sensor with platform smart_irrigation (Issue #144)

Describe the bug Upon HA start-up I get the following error:

2023-07-12 03:33:37.271 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform smart_irrigation Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 504, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 788, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/config/custom_components/smart_irrigation/sensor.py", line 557, in state self._state = self.update_state() ^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/smart_irrigation/sensor.py", line 516, in update_state self.evapotranspiration = self.get_evapotranspiration(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/smart_irrigation/sensor.py", line 694, in get_evapotranspiration t_dew = float(data["dew_point"])


KeyError: 'dew_point'

To Reproduce
Steps to reproduce the behavior:

  1.  Upon Home Assistant startup
  2.  See error

Expected behavior
A clear and concise description of what you expected to happen.

My configuration
Using in sensors-only mode, no OWM:

{
  "version": 1,
  "domain": "smart_irrigation",
  "title": "Smart Irrigation",
  "data": {
    "number_of_sprinklers": 6.0,
    "flow": 12.0,
    "area": 135.0,
    "api_key": null,
    "reference_evapotranspiration": [
      0.2,
      0.2,
      2.2,
      2.2,
      2.2,
      3.9,
      5.4,
      3.5,
      0.2,
      0.2,
      0.2,
      0.2
    ],
    "name": "Smart Irrigation",
    "sources": {
      "use_owm_precipitation": false,
      "use_owm_temperature": false,
      "use_owm_min_temperature": false,
      "use_owm_max_temperature": false,
      "use_owm_dewpoint": false,
      "use_owm_pressure": false,
      "use_owm_humidity": false,
      "use_owm_windspeed": false,
      "calculate_solar_radiation": false,
      "calculate_ET_value": true
    },
    "sensors": {
      "sensor_precipitation": "sensor.icorun3_precipitation_today",
      "sensor_temperature": "sensor.weather_outside_temperature",
      "sensor_min_temperature": "sensor.aggregation_temperature_daily_outside_min",
      "sensor_max_temperature": "sensor.aggregation_temperature_daily_outside_max",
      "sensor_dewpoint": "sensor.icorun3_dewpoint",
      "sensor_pressure": "sensor.icorun3_pressure",
      "sensor_humidity": "sensor.weather_outside_humidity",
      "sensor_windspeed": "sensor.icorun3_wind_speed",
      "sensor_solar_radiation": "sensor.icorun3_solar_radiation"
    }
  },
  "options": {},
  "pref_disable_new_entities": false,
  "pref_disable_polling": false,
  "source": "user",
  "unique_id": "Smart Irrigation",
  "disabled_by": null
}

Installed version
0.0.79

—
Reply to this email directly, view it on GitHub<https://github.com/jeroenterheerdt/HAsmartirrigation/issues/144> or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB6PIPQ77FFXFE5WP4YC4CTXQZOJFBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJLJONZXKZNENZQW2ZNLORUHEZLBMRPXI6LQMWBKK5TBNR2WLKRSGA2TGOBZGQYTON5ENZQW2ZNJNBQXGX3MMFRGK3ECUV3GC3DVMWSHI4TVMWSG4YLNMWXHOYLUMNUF6YLDORUXM2LUPGWHG5LCNJSWG5C7OR4XAZNFJFZXG5LFUZ2G64DJMNZZHAVEOR4XAZNKOJSXA33TNF2G64TZUV3GC3DVMWUTENRTGE3TSMJXG2BKI5DZOBS2K2LTON2WLJLWMFWHKZNKGE4DAOJWGE4DIMBYQKSHI6LQMWSWYYLCMVWKK5TBNR2WLKRSGA2TGOBZGQYTON5HORZGSZ3HMVZKMY3SMVQXIZI>.
You are receiving this email because you were assigned.

Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
clau-bucur commented 10 months ago

But as far as I understand those sensors indicate true if you're using OpenWeatherMap sensors, eg. "use_owm_dewpoint".

In my case they're false, so I'm not using OWM. For another older instance I was using OWM and in that case they were set to true.

jeroenterheerdt commented 10 months ago

oh you're right, my bad. can you post the relevant parts of your config from the .storage folder?

clau-bucur commented 10 months ago

See my first post, under My Configuration section. Or do you need something more?

jeroenterheerdt commented 10 months ago

thanks, not sure what is going on with me today, but I totally missed that. Can you tell me what your sensor.icorun3_dewpoint entity returns?

clau-bucur commented 10 months ago

That entity was the first thing I checked when I saw this issue. It returns temperatura data as expected, proper real numbers:

entity_id   last_updated    state
sensor.icorun3_dewpoint 19.07.2023 09:13:24.7395170 17.8
sensor.icorun3_dewpoint 19.07.2023 09:08:24.7168300 17.3
sensor.icorun3_dewpoint 19.07.2023 09:03:24.6235790 17.2
sensor.icorun3_dewpoint 19.07.2023 08:58:24.6034670 16.7
sensor.icorun3_dewpoint 19.07.2023 08:48:24.6028010 16.4
sensor.icorun3_dewpoint 19.07.2023 08:43:24.6115150 17.6
sensor.icorun3_dewpoint 19.07.2023 08:38:24.6968420 17.0
sensor.icorun3_dewpoint 19.07.2023 08:33:24.6027310 15.9
sensor.icorun3_dewpoint 19.07.2023 08:28:24.5809150 15.7
sensor.icorun3_dewpoint 19.07.2023 08:23:24.5807750 17.4
sensor.icorun3_dewpoint 19.07.2023 08:18:24.6061530 16.1
sensor.icorun3_dewpoint 19.07.2023 08:13:24.6098620 15.3
sensor.icorun3_dewpoint 19.07.2023 08:08:24.6817980 16.5
sensor.icorun3_dewpoint 19.07.2023 08:03:24.6630140 15.6
sensor.icorun3_dewpoint 19.07.2023 07:58:24.5978210 16.1
sensor.icorun3_dewpoint 19.07.2023 07:53:24.6500840 16.2
sensor.icorun3_dewpoint 19.07.2023 07:48:24.5981650 16.7
sensor.icorun3_dewpoint 19.07.2023 07:43:24.6196870 16.4
sensor.icorun3_dewpoint 19.07.2023 07:38:24.7241730 16.2

If you need I can get the states of the other entities of interest.

jeroenterheerdt commented 10 months ago

that's weird. If you did not already, can you set the logging level to debug in an effort to maybe capture what is going on?

clau-bucur commented 10 months ago

Here it is:

2023-07-19 21:02:04.938 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration thermal_comfort which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.938 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.939 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration aggregation which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.939 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration localtuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.939 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration tcp which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.940 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ltss which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.940 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration smart_irrigation which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.940 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration command_line which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.940 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration config_editor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.941 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration scheduler which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.941 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration moebot which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.941 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration telnet which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.941 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration wundergroundpws which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:04.942 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration mikrotik_router which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-19 21:02:15.512 INFO (MainThread) [custom_components.smart_irrigation] 
-------------------------------------------------------------------
Smart Irrigation
Version: 0.0.79
If you have any issues with this you need to open an issue here:
https://github.com/jeroenterheerdt/HASmartIrrigation/issues
-------------------------------------------------------------------

2023-07-19 21:02:15.512 INFO (MainThread) [custom_components.smart_irrigation] Smart Irrigation sensors: {'sensor_precipitation': 'sensor.icorun3_precipitation_today', 'sensor_temperature': 'sensor.weather_outside_temperature', 'sensor_min_temperature': 'sensor.aggregation_temperature_daily_outside_min', 'sensor_max_temperature': 'sensor.aggregation_temperature_daily_outside_max', 'sensor_dewpoint': 'sensor.icorun3_dewpoint', 'sensor_pressure': 'sensor.icorun3_pressure', 'sensor_humidity': 'sensor.weather_outside_humidity', 'sensor_windspeed': 'sensor.icorun3_wind_speed', 'sensor_solar_radiation': 'sensor.icorun3_solar_radiation'}
2023-07-19 21:02:15.512 INFO (MainThread) [custom_components.smart_irrigation] Auto refresh is enabled. Scheduling for 23:00.
2023-07-19 21:02:15.512 INFO (MainThread) [custom_components.smart_irrigation] Initial update scheduled for 2023-07-19 21:07:15.512817+03:00
2023-07-19 21:02:15.512 INFO (MainThread) [custom_components.smart_irrigation] Updating Smart Irrigation Data
2023-07-19 21:02:15.512 DEBUG (MainThread) [custom_components.smart_irrigation] Finished fetching Smart_Irrigation data in 0.000 seconds (success: True)
2023-07-19 21:02:15.784 ERROR (MainThread) [homeassistant.components.trend.binary_sensor] could not convert string to float: 'not set'
2023-07-19 21:02:15.786 ERROR (MainThread) [homeassistant.components.trend.binary_sensor] could not convert string to float: 'not set'
2023-07-19 21:02:16.197 INFO (MainThread) [custom_components.smart_irrigation.sensor] sensor __init__ for current_adjusted_run_time. bucket_delta=0
2023-07-19 21:02:16.197 INFO (MainThread) [custom_components.smart_irrigation.sensor] sensor __init__ for adjusted_run_time. bucket=0
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation] registering: type: Base Schedule Index, entity: sensor.smart_irrigation_base_schedule_index
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Base Schedule Index state: 607.5, attributes: {'number_of_sprinklers': 6.0, 'flow': '12.0', 'throughput': '72.0', 'reference_evapotranspiration': '[0.2, 0.2, 2.2, 2.2, 2.2, 3.9, 5.4, 3.5, 0.2, 0.2, 0.2, 0.2]', 'peak_evapotranspiration': '5.4', 'area': '135.0', 'precipitation_rate': '32.0', 'base_schedule_index_minutes': 10.12, 'auto_refresh': True, 'auto_refresh_time': '23:00', 'initial_update_delay': 300, 'coastal': False, 'estimate_solrad_from_temp': True, 'unit_of_measurement': 's', 'icon': 'mdi:sprinkler', 'friendly_name': 'Base Schedule Index'}
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Base Schedule Index
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Base Schedule Index
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation] registering: type: Hourly Adjusted Run Time, entity: sensor.smart_irrigation_hourly_adjusted_run_time
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time state: 116, attributes: {'rain': '0.0', 'snow': '0.0', 'precipitation': '0.0', 'evapotranspiration': '1.03', 'netto_precipitation': '-1.03', 'water_budget': 19.04, 'adjusted_run_time_minutes': 1.93, 'unit_of_measurement': 's', 'icon': 'mdi:sprinkler', 'friendly_name': 'Hourly Adjusted Run Time'}
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time, attribute: evapotranspiration, attribute_value: 1.03, numeric_part: 1.03, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time, attribute: netto_precipitation, attribute_value: -1.03, numeric_part: -1.03, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_to_hass restoring state, setting netto precipitation / bucket_delta to: -1.03
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time, attribute: precipitation, attribute_value: 0.0, numeric_part: 0.0, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time, attribute: rain, attribute_value: 0.0, numeric_part: 0.0, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time, attribute: snow, attribute_value: 0.0, numeric_part: 0.0, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time, attribute: water_budget, attribute_value: 19.04, numeric_part: 19.04, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Hourly Adjusted Run Time, attribute: adjusted_run_time_minutes, attribute_value: 1.93, numeric_part: 1.93, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Hourly Adjusted Run Time
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_precipitation, entity: sensor.icorun3_precipitation_today, sensor_state: None
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_temperature, entity: sensor.weather_outside_temperature, sensor_state: <state sensor.weather_outside_temperature=unknown; unit_of_measurement=°C, device_class=temperature, friendly_name=Outside weather temperature @ 2023-07-19T21:02:07.884263+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_min_temperature, entity: sensor.aggregation_temperature_daily_outside_min, sensor_state: <state sensor.aggregation_temperature_daily_outside_min=15.6; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-low, friendly_name=Daily minimum outside temperature @ 2023-07-19T21:02:07.966690+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_max_temperature, entity: sensor.aggregation_temperature_daily_outside_max, sensor_state: <state sensor.aggregation_temperature_daily_outside_max=31.2; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-high, friendly_name=Daily maximum outside temperature @ 2023-07-19T21:02:07.966856+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_dewpoint, entity: sensor.icorun3_dewpoint, sensor_state: None
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_pressure, entity: sensor.icorun3_pressure, sensor_state: None
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_humidity, entity: sensor.weather_outside_humidity, sensor_state: <state sensor.weather_outside_humidity=unknown; unit_of_measurement=%, device_class=humidity, friendly_name=Outside weather humidity @ 2023-07-19T21:02:07.884452+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_windspeed, entity: sensor.icorun3_wind_speed, sensor_state: None
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_solar_radiation, entity: sensor.icorun3_solar_radiation, sensor_state: None
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] rain: 0, snow: 0
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation] registering: type: Daily Adjusted Run Time, entity: sensor.smart_irrigation_daily_adjusted_run_time
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Daily Adjusted Run Time state: 0, attributes: {'water_budget': 0.0, 'bucket': '39.76', 'lead_time': 0, 'maximum_duration': -1, 'adjusted_run_time_minutes': 0.0, 'force_mode_duration': 0, 'force_mode_enabled': False, 'unit_of_measurement': 's', 'icon': 'mdi:sprinkler', 'friendly_name': 'Daily Adjusted Run Time'}
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Daily Adjusted Run Time, attribute: water_budget, attribute_value: 0.0, numeric_part: 0.0, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Daily Adjusted Run Time, attribute: bucket, attribute_value: 39.76, numeric_part: 39.76, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_to_hass restoring state, settting bucket to: 39.76
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] async_added_t_hass type: Daily Adjusted Run Time, attribute: adjusted_run_time_minutes, attribute_value: 0.0, numeric_part: 0.0, show_units: False, a_val was str or contained ' ': False
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Daily Adjusted Run Time
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] Calculated water_budget = 0 and adjusted_run_time: 0 for type: Daily Adjusted Run Time. Bucket value was: 39.76, and base schedule index is: 607.5, force mode is: False, force mode duration is: 0, lead_time is: 0, maximum_duration: -1, change percentage: 1.0, type: Daily Adjusted Run Time
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] calculating wb and art for daily adjusted run time, result: {'wb': 0, 'art': 0}
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Daily Adjusted Run Time
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] Calculated water_budget = 0 and adjusted_run_time: 0 for type: Daily Adjusted Run Time. Bucket value was: 39.76, and base schedule index is: 607.5, force mode is: False, force mode duration is: 0, lead_time is: 0, maximum_duration: -1, change percentage: 1.0, type: Daily Adjusted Run Time
2023-07-19 21:02:16.200 INFO (MainThread) [custom_components.smart_irrigation.sensor] calculating wb and art for daily adjusted run time, result: {'wb': 0, 'art': 0}
2023-07-19 21:02:16.201 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform smart_irrigation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 504, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 788, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 557, in state
    self._state = self.update_state()
                  ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 516, in update_state
    self.evapotranspiration = self.get_evapotranspiration(data)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 694, in get_evapotranspiration
    t_dew = float(data["dew_point"])
                  ~~~~^^^^^^^^^^^^^
KeyError: 'dew_point'
2023-07-19 21:02:16.208 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up smart_irrigation platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 504, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 788, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 557, in state
    self._state = self.update_state()
                  ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 516, in update_state
    self.evapotranspiration = self.get_evapotranspiration(data)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 694, in get_evapotranspiration
    t_dew = float(data["dew_point"])
                  ~~~~^^^^^^^^^^^^^
KeyError: 'dew_point'
2023-07-19 21:07:15.513 INFO (MainThread) [custom_components.smart_irrigation] Initial update triggered - calling calculate hourly adjusted run time now.
2023-07-19 21:07:15.514 INFO (MainThread) [custom_components.smart_irrigation] Calculate Hourly Adjusted Run Time service called, calculating now.
2023-07-19 21:07:15.514 INFO (MainThread) [custom_components.smart_irrigation] Updating Smart Irrigation Data
2023-07-19 21:07:15.515 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] _hourly_data_updated, calling update_state for type Hourly Adjusted Run Time
2023-07-19 21:07:15.515 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state for type: Hourly Adjusted Run Time
2023-07-19 21:07:15.524 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_precipitation, entity: sensor.icorun3_precipitation_today, sensor_state: <state sensor.icorun3_precipitation_today=0.0; state_class=total_increasing, unit_of_measurement=mm, attribution=Data provided by the WUnderground weather service, device_class=precipitation, icon=mdi:umbrella, friendly_name=Precipitation Today @ 2023-07-19T21:02:16.325017+03:00>
2023-07-19 21:07:15.526 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_temperature, entity: sensor.weather_outside_temperature, sensor_state: <state sensor.weather_outside_temperature=21.2; unit_of_measurement=°C, device_class=temperature, friendly_name=Outside weather temperature @ 2023-07-19T21:05:17.712769+03:00>
2023-07-19 21:07:15.527 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_min_temperature, entity: sensor.aggregation_temperature_daily_outside_min, sensor_state: <state sensor.aggregation_temperature_daily_outside_min=15.6; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-low, friendly_name=Daily minimum outside temperature @ 2023-07-19T21:02:07.966690+03:00>
2023-07-19 21:07:15.527 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_max_temperature, entity: sensor.aggregation_temperature_daily_outside_max, sensor_state: <state sensor.aggregation_temperature_daily_outside_max=31.2; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-high, friendly_name=Daily maximum outside temperature @ 2023-07-19T21:02:07.966856+03:00>
2023-07-19 21:07:15.527 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_dewpoint, entity: sensor.icorun3_dewpoint, sensor_state: <state sensor.icorun3_dewpoint=19.8; state_class=measurement, unit_of_measurement=°C, attribution=Data provided by the WUnderground weather service, device_class=temperature, icon=mdi:water, friendly_name=Dewpoint @ 2023-07-19T21:02:16.324439+03:00>
2023-07-19 21:07:15.528 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_pressure, entity: sensor.icorun3_pressure, sensor_state: <state sensor.icorun3_pressure=1006.77; state_class=measurement, unit_of_measurement=mbar, attribution=Data provided by the WUnderground weather service, device_class=pressure, icon=mdi:gauge, friendly_name=Pressure @ 2023-07-19T21:02:16.325117+03:00>
2023-07-19 21:07:15.529 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_humidity, entity: sensor.weather_outside_humidity, sensor_state: <state sensor.weather_outside_humidity=92; unit_of_measurement=%, device_class=humidity, friendly_name=Outside weather humidity @ 2023-07-19T21:02:48.670663+03:00>
2023-07-19 21:07:15.530 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_windspeed, entity: sensor.icorun3_wind_speed, sensor_state: <state sensor.icorun3_wind_speed=1.1; state_class=measurement, unit_of_measurement=km/h, attribution=Data provided by the WUnderground weather service, device_class=wind_speed, icon=mdi:weather-windy, friendly_name=Wind Speed @ 2023-07-19T21:02:16.325362+03:00>
2023-07-19 21:07:15.531 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_solar_radiation, entity: sensor.icorun3_solar_radiation, sensor_state: <state sensor.icorun3_solar_radiation=5.8; state_class=measurement, unit_of_measurement=W/m², attribution=Data provided by the WUnderground weather service, device_class=irradiance, icon=mdi:weather-sunny, friendly_name=Solar Radiation @ 2023-07-19T21:02:16.323882+03:00>
2023-07-19 21:07:15.531 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] rain: 0.0, snow: 0.0
2023-07-19 21:07:15.531 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] calculated evapotranspiration: 0.7073222543885053
2023-07-19 21:07:15.531 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] Calculated water_budget = 0.13098560266453801 and adjusted_run_time: 80 for type: Hourly Adjusted Run Time. Bucket value was: -0.7073222543885053, and base schedule index is: 607.5, force mode is: False, force mode duration is: 0, lead_time is: 0, maximum_duration: -1, change percentage: 1.0, type: Hourly Adjusted Run Time
2023-07-19 21:07:15.532 INFO (SyncWorker_4) [custom_components.smart_irrigation.sensor] update_state: just updated hourly_precipitation_list: [0.0] and hourly_evapotranspiration_list: [0.7073222543885053]
2023-07-19 21:07:15.534 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Hourly Adjusted Run Time
2023-07-19 21:07:15.534 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_precipitation, entity: sensor.icorun3_precipitation_today, sensor_state: <state sensor.icorun3_precipitation_today=0.0; state_class=total_increasing, unit_of_measurement=mm, attribution=Data provided by the WUnderground weather service, device_class=precipitation, icon=mdi:umbrella, friendly_name=Precipitation Today @ 2023-07-19T21:02:16.325017+03:00>
2023-07-19 21:07:15.534 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_temperature, entity: sensor.weather_outside_temperature, sensor_state: <state sensor.weather_outside_temperature=21.2; unit_of_measurement=°C, device_class=temperature, friendly_name=Outside weather temperature @ 2023-07-19T21:05:17.712769+03:00>
2023-07-19 21:07:15.534 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_min_temperature, entity: sensor.aggregation_temperature_daily_outside_min, sensor_state: <state sensor.aggregation_temperature_daily_outside_min=15.6; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-low, friendly_name=Daily minimum outside temperature @ 2023-07-19T21:02:07.966690+03:00>
2023-07-19 21:07:15.534 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_max_temperature, entity: sensor.aggregation_temperature_daily_outside_max, sensor_state: <state sensor.aggregation_temperature_daily_outside_max=31.2; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-high, friendly_name=Daily maximum outside temperature @ 2023-07-19T21:02:07.966856+03:00>
2023-07-19 21:07:15.535 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_dewpoint, entity: sensor.icorun3_dewpoint, sensor_state: <state sensor.icorun3_dewpoint=19.8; state_class=measurement, unit_of_measurement=°C, attribution=Data provided by the WUnderground weather service, device_class=temperature, icon=mdi:water, friendly_name=Dewpoint @ 2023-07-19T21:02:16.324439+03:00>
2023-07-19 21:07:15.535 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_pressure, entity: sensor.icorun3_pressure, sensor_state: <state sensor.icorun3_pressure=1006.77; state_class=measurement, unit_of_measurement=mbar, attribution=Data provided by the WUnderground weather service, device_class=pressure, icon=mdi:gauge, friendly_name=Pressure @ 2023-07-19T21:02:16.325117+03:00>
2023-07-19 21:07:15.535 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_humidity, entity: sensor.weather_outside_humidity, sensor_state: <state sensor.weather_outside_humidity=92; unit_of_measurement=%, device_class=humidity, friendly_name=Outside weather humidity @ 2023-07-19T21:02:48.670663+03:00>
2023-07-19 21:07:15.535 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_windspeed, entity: sensor.icorun3_wind_speed, sensor_state: <state sensor.icorun3_wind_speed=1.1; state_class=measurement, unit_of_measurement=km/h, attribution=Data provided by the WUnderground weather service, device_class=wind_speed, icon=mdi:weather-windy, friendly_name=Wind Speed @ 2023-07-19T21:02:16.325362+03:00>
2023-07-19 21:07:15.535 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_solar_radiation, entity: sensor.icorun3_solar_radiation, sensor_state: <state sensor.icorun3_solar_radiation=5.8; state_class=measurement, unit_of_measurement=W/m², attribution=Data provided by the WUnderground weather service, device_class=irradiance, icon=mdi:weather-sunny, friendly_name=Solar Radiation @ 2023-07-19T21:02:16.323882+03:00>
2023-07-19 21:07:15.535 INFO (MainThread) [custom_components.smart_irrigation.sensor] rain: 0.0, snow: 0.0
2023-07-19 21:07:15.536 INFO (MainThread) [custom_components.smart_irrigation.sensor] calculated evapotranspiration: 0.7073222543885053
2023-07-19 21:07:15.536 INFO (MainThread) [custom_components.smart_irrigation.sensor] Calculated water_budget = 0.13098560266453801 and adjusted_run_time: 80 for type: Hourly Adjusted Run Time. Bucket value was: -0.7073222543885053, and base schedule index is: 607.5, force mode is: False, force mode duration is: 0, lead_time is: 0, maximum_duration: -1, change percentage: 1.0, type: Hourly Adjusted Run Time
2023-07-19 21:07:15.536 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state: just updated hourly_precipitation_list: [0.0, 0.0] and hourly_evapotranspiration_list: [0.7073222543885053, 0.7073222543885053]
2023-07-19 21:07:15.536 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Hourly Adjusted Run Time
2023-07-19 21:07:15.536 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_precipitation, entity: sensor.icorun3_precipitation_today, sensor_state: <state sensor.icorun3_precipitation_today=0.0; state_class=total_increasing, unit_of_measurement=mm, attribution=Data provided by the WUnderground weather service, device_class=precipitation, icon=mdi:umbrella, friendly_name=Precipitation Today @ 2023-07-19T21:02:16.325017+03:00>
2023-07-19 21:07:15.536 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_temperature, entity: sensor.weather_outside_temperature, sensor_state: <state sensor.weather_outside_temperature=21.2; unit_of_measurement=°C, device_class=temperature, friendly_name=Outside weather temperature @ 2023-07-19T21:05:17.712769+03:00>
2023-07-19 21:07:15.536 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_min_temperature, entity: sensor.aggregation_temperature_daily_outside_min, sensor_state: <state sensor.aggregation_temperature_daily_outside_min=15.6; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-low, friendly_name=Daily minimum outside temperature @ 2023-07-19T21:02:07.966690+03:00>
2023-07-19 21:07:15.537 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_max_temperature, entity: sensor.aggregation_temperature_daily_outside_max, sensor_state: <state sensor.aggregation_temperature_daily_outside_max=31.2; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-high, friendly_name=Daily maximum outside temperature @ 2023-07-19T21:02:07.966856+03:00>
2023-07-19 21:07:15.537 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_dewpoint, entity: sensor.icorun3_dewpoint, sensor_state: <state sensor.icorun3_dewpoint=19.8; state_class=measurement, unit_of_measurement=°C, attribution=Data provided by the WUnderground weather service, device_class=temperature, icon=mdi:water, friendly_name=Dewpoint @ 2023-07-19T21:02:16.324439+03:00>
2023-07-19 21:07:15.537 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_pressure, entity: sensor.icorun3_pressure, sensor_state: <state sensor.icorun3_pressure=1006.77; state_class=measurement, unit_of_measurement=mbar, attribution=Data provided by the WUnderground weather service, device_class=pressure, icon=mdi:gauge, friendly_name=Pressure @ 2023-07-19T21:02:16.325117+03:00>
2023-07-19 21:07:15.537 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_humidity, entity: sensor.weather_outside_humidity, sensor_state: <state sensor.weather_outside_humidity=92; unit_of_measurement=%, device_class=humidity, friendly_name=Outside weather humidity @ 2023-07-19T21:02:48.670663+03:00>
2023-07-19 21:07:15.537 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_windspeed, entity: sensor.icorun3_wind_speed, sensor_state: <state sensor.icorun3_wind_speed=1.1; state_class=measurement, unit_of_measurement=km/h, attribution=Data provided by the WUnderground weather service, device_class=wind_speed, icon=mdi:weather-windy, friendly_name=Wind Speed @ 2023-07-19T21:02:16.325362+03:00>
2023-07-19 21:07:15.537 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_solar_radiation, entity: sensor.icorun3_solar_radiation, sensor_state: <state sensor.icorun3_solar_radiation=5.8; state_class=measurement, unit_of_measurement=W/m², attribution=Data provided by the WUnderground weather service, device_class=irradiance, icon=mdi:weather-sunny, friendly_name=Solar Radiation @ 2023-07-19T21:02:16.323882+03:00>
2023-07-19 21:07:15.537 INFO (MainThread) [custom_components.smart_irrigation.sensor] rain: 0.0, snow: 0.0
2023-07-19 21:07:15.538 INFO (MainThread) [custom_components.smart_irrigation.sensor] calculated evapotranspiration: 0.7073222543885053
2023-07-19 21:07:15.538 INFO (MainThread) [custom_components.smart_irrigation.sensor] Calculated water_budget = 0.13098560266453801 and adjusted_run_time: 80 for type: Hourly Adjusted Run Time. Bucket value was: -0.7073222543885053, and base schedule index is: 607.5, force mode is: False, force mode duration is: 0, lead_time is: 0, maximum_duration: -1, change percentage: 1.0, type: Hourly Adjusted Run Time
2023-07-19 21:07:15.538 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state: just updated hourly_precipitation_list: [0.0, 0.0, 0.0] and hourly_evapotranspiration_list: [0.7073222543885053, 0.7073222543885053, 0.7073222543885053]
jeroenterheerdt commented 10 months ago

so it looks like the first time it tries to get the states the sensors are all empty:

2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state for type: Hourly Adjusted Run Time
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_precipitation, entity: sensor.icorun3_precipitation_today, sensor_state: None
2023-07-19 21:02:16.198 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_temperature, entity: sensor.weather_outside_temperature, sensor_state: <state sensor.weather_outside_temperature=unknown; unit_of_measurement=°C, device_class=temperature, friendly_name=Outside weather temperature @ 2023-07-19T21:02:07.884263+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_min_temperature, entity: sensor.aggregation_temperature_daily_outside_min, sensor_state: <state sensor.aggregation_temperature_daily_outside_min=15.6; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-low, friendly_name=Daily minimum outside temperature @ 2023-07-19T21:02:07.966690+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_max_temperature, entity: sensor.aggregation_temperature_daily_outside_max, sensor_state: <state sensor.aggregation_temperature_daily_outside_max=31.2; state_class=measurement, entity_id=['sensor.weather_outside_temperature'], unit_of_measurement=°C, device_class=temperature, icon=mdi:thermometer-high, friendly_name=Daily maximum outside temperature @ 2023-07-19T21:02:07.966856+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_dewpoint, entity: sensor.icorun3_dewpoint, sensor_state: None
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_pressure, entity: sensor.icorun3_pressure, sensor_state: None
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_humidity, entity: sensor.weather_outside_humidity, sensor_state: <state sensor.weather_outside_humidity=unknown; unit_of_measurement=%, device_class=humidity, friendly_name=Outside weather humidity @ 2023-07-19T21:02:07.884452+03:00>
2023-07-19 21:02:16.199 INFO (MainThread) [custom_components.smart_irrigation.sensor] update_state USING A SENSOR for instance Smart_Irrigation, type: Hourly Adjusted Run Time, sensor: sensor_windspeed, entity: sensor.icorun3_wind_speed, sensor_state: None

which is then followed by the bug. Right after however, it works fine. So it looks like sometimes the request succeeds and sometimes it doesn't. How often does this happen?

clau-bucur commented 10 months ago

Could it be due to the fact that right after HA boots the entities of the Wundergroundpws integration (sensor.icorun3_*) do not have their states yet loaded but smart_irrigation already accesses them and does not expect None state?

It's always happening, from the very moment I created this integration using sensor data from my own weather station (station sends data to Wunderground and I use a custom integration to fetch that data). I noticed the stack trace in the logs right then (a couple of months back) but I ignored it as we had alot of rain right at the beginning and I thought the DART state keeping on 0 is just correct.

But now the rains are gone for quite some time which raised my attention to the DART sensor as it's state keeps remaining 0 no matter the weather outside, and no irrigation started and the grass started to lose it's nice green.

Last year I used smart_irrigation with OWM integration and it ran butter-smooth.

jeroenterheerdt commented 10 months ago

that could very well be. I think there is an 'delay' configuration that would delay the time before the Smart Irrigation gets set up so hopefully the loading has finished.

clau-bucur commented 10 months ago

Do you mean this? It's set to 300 in my case, I think!? Though "Estimate solar radiation from temperature" should be unset. image

jeroenterheerdt commented 10 months ago

Yes, that is what I meant - what if you bump that up to an hour, just as an experiment? I wonder if that is the cause here...

clau-bucur commented 10 months ago

Set to 3600, updated to 0.0.80 and did a HA restart. Unfortunately no change:

Logger: homeassistant.components.sensor
Source: custom_components/smart_irrigation/sensor.py:694
Integration: Sensor (documentation, issues)
First occurred: 22:41:54 (2 occurrences)
Last logged: 22:41:54

Error adding entities for domain sensor with platform smart_irrigation
Error while setting up smart_irrigation platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 504, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 788, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 557, in state
    self._state = self.update_state()
                  ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 516, in update_state
    self.evapotranspiration = self.get_evapotranspiration(data)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/sensor.py", line 694, in get_evapotranspiration
    t_dew = float(data["dew_point"])
                  ~~~~^^^^^^^^^^^^^
KeyError: 'dew_point'
clau-bucur commented 10 months ago

And I don't see to wait 1 hour. The component started right then when the error occurred:

2023-07-22 22:41:54.077 INFO (MainThread) [custom_components.smart_irrigation]
-------------------------------------------------------------------
Smart Irrigation
Version: 0.0.80
If you have any issues with this you need to open an issue here:
https://github.com/jeroenterheerdt/HASmartIrrigation/issues
-------------------------------------------------------------------
jeroenterheerdt commented 10 months ago

That’s weird. I believe you’ve found a bug ☹

I am working on version 2, which is a complete re-write of the component. I’d recommend waiting until that is ready. Of course, I also welcome a PR to fix the bug 😊

clau-bucur commented 10 months ago

I'm not too good at Python, but I'll make a small PR. From what I see in the code, the "initial_update_delay" is working properly, however I don't think it's serving the purpose we are talking about here. At least from the little I understood in the code.

Best I can do with a PR is handle the exception in the get_evapotranspiration method so that it will not fail upon adding entities to HA.

jeroenterheerdt commented 10 months ago

thanks, yeah, I think the initial_update_delay doesn't work as intended so this is the best we can do at the moment.