petergridge / irrigation_V5

Version 5 of irrigation program - significant breaking change from v4
GNU General Public License v3.0
0 stars 0 forks source link

Problem loading v5 #1

Closed rjbungay closed 2 years ago

rjbungay commented 2 years ago

Hi Peter

Firstly, thank you for creating a great integration. I came across this a few weeks ago and set up version 4 and got it working, albeit with 1 issue I’ll come back to. I also installed the custom card and rainfactor from yourself.

I saw today that you had released v5 so went ahead and updated. I can’t get the v5 to load, this appears to be something to do with a zone name, perhaps you can shed some light?

2022-08-20 20:07:52.633 ERROR (MainThread) [homeassistant.components.switch] Error while setting up irrigationprogram platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform await asyncio.gather(pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities await asyncio.gather(tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 775, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/irrigationprogram/switch.py", line 320, in async_added_to_hass z_name = slugify(zone.get(CONF_NAME,self.hass.states.get(zone.get(ATTR_ZONE)).name)) AttributeError: 'NoneType' object has no attribute 'name'

There is no "standard" config in the v5 package even though you make reference to this. I basically modified the v4 config I was using based on your config snippets. After getting the issue I reduced to a minimal config attached below.

The issue I mentioned previously in v4 might be more of an intended "feature", I’m not sure. I attempted to configure the rainfactor watering adjustment and the "eco" mode. The eco mode works and runs several short cycles but the adjustment doesn’t seem to work, I’m wondering if you are not able to run these two features together?

thanks for any help you can provide?

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'

switch:
  - platform: irrigationprogram
    switches: 
      morning:

irrigation_on: Enable irrigation

friendly_name: Morning Program

start_time: Start time

show_config: Show configuration

run_freq: input_select.irrigation_freq

        zones:
          - zone: switch.plant_water

name: Pot Plants

zone_group: Zone group

water: Water

wait: Wait

repeat: Repeat

rain_sensor: binary_sensor.raining

enable_zone: Enable zone

water_adjustment: sensor.rainfactor

flow_sensor: sensor.irrigation_flow_sensor

run_freq: input_select.morning_zone1_frequency

old v4 config

switch:

#

- platform: irrigationprogram

switches:

morning:

irrigation_on: input_boolean.irrigation_on

start_time: input_datetime.irrigation_morning_start_time

will run only on selected run days

run_freq: input_select.irrigation_run_days

icon: mdi:fountain

zones:

- zone: switch.plant_water

rain_sensor: binary_sensor.raining

ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor

name: Pot Plants

water: input_number.irrigation_pot_plants_run

water_adjustment: sensor.rainfactor

wait: input_number.irrigation_pot_plants_wait

repeat: input_number.irrigation_pot_plants_repeat

icon: mdi:flower

afternoon:

irrigation_on: input_boolean.irrigation_on

start_time: input_datetime.irrigation_afternoon_start_time

will run only on selected run days

run_freq: input_select.irrigation_run_days

icon: mdi:fountain

zones:

- zone: switch.plant_water

rain_sensor: binary_sensor.raining

ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor

name: Pot Plants

water: input_number.irrigation_pot_plants_run

water_adjustment: sensor.rainfactor

wait: input_number.irrigation_pot_plants_wait

repeat: input_number.irrigation_pot_plants_repeat

icon: mdi:flower

input_number:

irrigation_adjust_run:

name: water adjustment

min: 0

max: 1

step: 0.2

icon: mdi:water-pump-off

irrigation_pot_plants_run:

name: water

min: 1

max: 10

step: 1

icon: mdi:water

irrigation_pot_plants_wait:

name: wait

min: 0

max: 10

step: 1

icon: mdi:timer-sand

irrigation_pot_plants_repeat:

name: repeat

min: 1

max: 5

step: 1

icon: mdi:repeat

irrigation_lawn_run:

name: water

min: 1

max: 30

step: 1

icon: mdi:water

irrigation_vege_run:

name: water

min: 1

max: 30

step: 1

icon: mdi:water

input_select:
# Run Days can be a Numeric, this represent the frequency of watering or Days where it will run on the specified days

  irrigation_run_days:
    name: Run Days
    options:
      - "['Mon','Thu']"
      - "['Tue','Fri']"
      - "['Wed','Sat']"
      - "['Mon','Wed','Fri']"
      - "['Mon','Tue','Wed','Thu','Fri','Sat','Sun']"
      - "1"
      - "2"
      - "3"
      - "4"
      - "5"
      - "6"
      - "7"

binary_sensor:
  - platform: template
    sensors:
      raining:
        device_class: moisture
        value_template: "{{ is_state('input_boolean.dummy_rain_sensor', 'on') }}"
        icon_template: >-
          {% if is_state("binary_sensor.raining", "on") %}
            mdi:weather-pouring
          {% else %}
            mdi:weather-sunny
          {% endif %}
rjbungay commented 2 years ago

Apologies, the "#" commented out sections seem to have played havoc with the copy and pasted of irrigation.yaml on my iPad, I’ll boot up the PC and see if I can attach the file.

rjbungay commented 2 years ago

irrigation.yaml.txt

petergridge commented 2 years ago

Hi,

Thanks for the feedback, I am in the midst of testing this new release and appreciate the help. I haven't published this on the forums yet as there is still a little more work to do.

I am currently working to implement config flow so there will hopefully be no more yaml to maintain. Still a some work/learning required. I was planning to release this version once I had that complete. But happy for you to try this interim solution, it is functional except for the bug you found :) I am sure there are a few more lurking in there.

I will release a fix for the issue you found, it is a timing issue with this component starting before the switch entities are loaded in HASS, I haven't experienced this on my test bed as it does not use 'real' integrations. so it is great to get some real world validation of the product.

I would also value any other feedback in context of the documentation or features available.

I will let you know when the next release is available.

If you don't mind me asking where in the world are you I am always interested in knowing where this is being used and what for, one user uses this to control his lawn mower!

petergridge commented 2 years ago

In relation to the rain factor, it should reduce/increase the water time or volume by the multiplication factor.

I have reviewed this functionality in V5 along with the volume based watering. There has been a lot of refactoring in this release and some great support from one user in particular with testing. As more features are requested/added it is getting harder to test.

rjbungay commented 2 years ago

Hi Peter, thanks for getting back to me. I’m based in the UK. I hadn’t realised that you had not really released this version yet, it was HACS that prompted me to update (via the custom card). I’m happy to rest and look forward to the fix. BTW the adjustment didn’t seem to be working in v4 either with ECO mode enabled.

Regards Richard

petergridge commented 2 years ago

Hi Richard, V5.0.5 is release now. Hopefully this resolves your issue.

Let me know how you go with the adjustment. you can associate an input_number helper with that function it makes it easier to validate. I would really appreciate if you tested the functionality you use with this version and let me know what you used and how it performed.

Cheers Pete

rjbungay commented 2 years ago

Hi Pete Yes, that has sorted the loading error. I’ll test the new version5 and let you know how I get on. Many thanks for the fast update. Cheers Richard

petergridge commented 2 years ago

That's great Richard thanks for letting me know. I'll close this issue.