Integrate with OpenSprinkler

I have pushed an update, you will need to remove all the previous hass_opensprinkler.py files from the custom_components folder and just add the new hass_opensprinkler folder there.

Let me know if there are any issues. Sorry it took so long but I was on holiday and while I was away the sd card for my raspberrypi died so I had to get a new one and set up home assistant again

2 Likes

Thanks for your work and the updates.

Hi @vinteo,

Iā€™m looking forward to installing your component. Thanks for the work!

Any chance you can integrate with the custom_updater? It would require putting a JSON file at the top level of your repository. Info is at:

Thanks!

Hi @sgruby, thanks for the suggestion, I have added the support for custom updater, please upgrade to the latest versions of both custom_updater and hass_opensprinkler and check the README for the config example.

Awesome, thanks!

Hey. Had the same trouble with inputs.
Had to create them manually.
No docker here however.
Otherwise ok, thanks for the component.
I have to understand now why scenes do not work (the rest yes)

Hello

This is great.

I am in the process of connecting my new opensprinkler in my greenhouse. I already have a few miflora sensors and have used them with miflora daemon on a raspberry pi zero for a year or two. I would also like to start irrigation on a few of the plants based on humidity values from miflora sensors. They are updating every 5 min with mqtt to home assistant.

Do you think something like this may work? Any pitfalls? have only done a dry run, and it seems to work as expected.

From my automation.yaml:

- alias: 'water01'
  initial_state: 'on'
  trigger:
    platform: time_pattern
    minutes: '/5'
    seconds: 00
  condition:
    condition: or
    conditions:
      - condition: numeric_state
        entity_id: sensor.plante1_moisture
        below: 30
  action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.s01_timer
        value: '1'
    - service: switch.turn_on
      data:
        entity_id: switch.s01

- alias: 'water02'
  initial_state: 'on'
  trigger:
    platform: time_pattern
    minutes: '/5'
    seconds: 00
  condition:
    condition: or
    conditions:
      - condition: numeric_state
        entity_id: sensor.plante2_moisture
        below: 30
  action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.s02_timer
        value: '1'
        #to spread out solenoid power and water preasure
    - delay: '00:01:30'
    - service: switch.turn_on
      data:
        entity_id: switch.s02

I also tested watering times under one minute with the following action in automation:


  action:
    - service: switch.turn_on
      data:
        entity_id: switch.s04        
    - delay: '00:00:10'
    - service: switch.turn_off
      data:
        entity_id: switch.s04

It also seems to be working fine.

I finally got it working ā€¦ well kindaā€¦
Sensor Work fine. However, when I try using the which, I have the following error.

Do any you encounter this when setting it up ?

In the frontend
image

In the log

2019-06-27 21:50:23 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1852492976] 'NoneType' object has no attribute 'state'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1150, in async_call
    self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1172, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 194, in handle_service
    required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 316, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  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/hass_opensprinkler/switch.py", line 47, in turn_on
    self._station.turn_on(int(float(mins.state)))

I still havenā€™t figured out how to fix this, but you can manually create the input_numbers to get around this. Add something like this to your config:

input_number:
  <station_name>_timer:
    min: 1
    max: 30
    step: 1
    mode: slider

Replace <station_name> with your station name, match the ones for sensors/swicthes that were created. Create one for each station

Tx Vinteo, This work Nicely.

I suggest adding this to your documentation. It may help other users.

I see that updating the sensor can take some time (longer than the scheduled update interval of 0:00:05. See warning below.

Do you support using a longer schedulers update time ?

2019-06-28 08:28:27 WARNING (MainThread) [homeassistant.components.switch] Updating hass_opensprinkler switch took longer than the scheduled update interval 0:00:05

I have added a troubleshooting section to the readme with some info on this issue. thanks for the suggestion

Also I created an issue for the update interval here: https://github.com/vinteo/hass-opensprinkler/issues/27

With the input_number I got the timer back but how do I get the switch back?

input_number:
  front_yard_timer:
    min: 1
    max: 30
    step: 1
    mode: slider
  front_drips_timer:
    min: 1
    max: 30
    step: 1
    mode: slider

hi @ryanjohnson00, the switches should still be there, can you elaborate on your issue? Can you see the switches in the dev states page?

The input_number config should in addition hass_opensprinkler to the config not replace it

@Vincent - The sensor, switch and binary_sensor are not in the states page. I am not sure when they disappeared, I am on 0.95.4. I saw there was a change on the opensprinkler GitHub and I downloaded the branch, put that in the custom_components folder. My configuration.yaml has not change for the login.

A home assistant restart didnā€™t help?

I figured it out. Noobie mistake. I uploaded the hass-opensprinkler-master instead of the hass-opensprinkler folder.

great! at least we figured it out! :slight_smile:

Hi @vinteo,
I have been using successfully your component for the last few month.
Great work by the way !

Looking at the log doing some long time due maintenance, I have seen a lot of error generated by the integration. In a day, I can actually have thousandth of line of log generated by the integration.

Do you have the same behaviour on your end ? What would be the most probable cause ?
My open sprinkler is on a rasberry Pie, do you have the same setup ?

What could I do to improve the situation ?

hi @Marc-Antoine_Seyer,

It looks like connection issues, I donā€™t have the same logs, definitely not in the thousands. My setup is hass.io on a raspberry pi3. I would try check the WiiFi connection on the OpenSprinkler, does it have a strong signal and no dropouts? Since it mostly looks like its timing out trying to connect to the opensprinkler API

Having said that I think the error handling on the API requests on my component is not working as well as it should, so it doesnā€™t handle errors well. If everything is working there should not be any issues but when there are errors it may give the wrong error etc.