My Garden Irrigation

I don’t know what we have different, but to me without that modification the script "run a cycle " didn’t want to know how to work! now i’m testing everything and it seems there are no problems. this morning, I irrigated at the right time and correctly programmed the next irrigation. In the coming weeks rain is expected also in my part (Tuscany) then I will try better also the part related to the weather adjustments that I would like to operate with netatmo rain gauge.

@daxda I’m glad it is working for you. Good luck with the Netatmo, having your own rain gauge is the perfect solution!

I hope you’ll report back here with an update when you have some experience with the weather adjustments!

Hi @klogg and thanks for sharing this nice irrigation code!

I’m trying to use it with a NodeMCU with Tasmota connected to a board with 4 relays.

I’ve set 1 min for zone 1 and 2 and 2 min for zone 3 and 4, but after 8 secs for the first two zones and 36 secs for the other two zones, the relays turn to off.

What can I check?

Thanks

@woody4165 Try to comment out command for pulsetime to see if it works. Also check for the name of your topic: the name inside the code is sonoff4ch01 but you need to rename according to your specs.

EDIT: @klogg I’m not sure, but pulsetime command must be all uppercase: PULSETIME

I’m not sure…
I have been out all day but I started a cycle of 2 minutes for every zone and pulsetime (still using lower case) seems to have been set correctly to 35 seconds (60 x 2 + 15). For example pulsetime2 on the Tasmota console gives this.

image

However, looking at the irrigation history it appears to have only run for 1 minute (or less as I think I round to the nearest minute).It looks like there is something off with the pulsetime command but it is too late for me to look into it now…

EDIT: yes, the wiki is quite clear, it is not as simple as just setting the number in seconds!

Set PulseTime of relay<x> in 0.1 seconds 
0 / off = disable use of PulseTime for Relay<x> (default) 
1..111 = set PulseTime for Relay<x> in 0.1 seconds increments 
112..64900 = set PulseTime for Relay<x> with 1 seconds increment starting with 12 seconds (add 100 to desired interval in seconds, e.g. 113 = 13 seconds and 220 = 120 seconds) 

I’ll fix the code tomorrow…

I’ve also read from “italian translated docs” on a it forum that TELEPERIOD must be greater that PULSETIME but i don’t find corrispective in the ufficial wiki docs so i’m not sure

Thanks @itajackass

It doesn’t seem to affect the pulsetime script.
I’ve removed the call from the sequence, but I always get this strange switch off of the zones:

1 min set = 8sec duration
2 min set = 36sec duration
3 min set = 1:36 min duration

Another thing, I don’t know if it’s normal, if I have a program running (manual or not) and I click on the Master Control Switch to OFF, the open zone will immediately close, but if I click it to ON I still see the “Time remaining” going on and if there is another zone to open it will start it.
Even if the Master Control Switch remain OFF, when it reaches a new zone to open, it will open…

I thought the Master Control Switch acts as something to force to stop the program going on, if any.
It might be useful to have a general stop switch to cancel any program running and reset it to idle.

If I can help in some way, let me know!

Thanks

PS: This is the console log from Tasmota

10:46:39 MQT: stat/EspGarden2/RESULT = {"PulseTime1":"75 (Active 75)"}
10:46:44 MQT: stat/EspGarden2/RESULT = {"POWER1":"ON"}
10:46:44 MQT: stat/EspGarden2/POWER1 = ON
10:46:44 MQT: stat/EspGarden2/RESULT = {"POWER2":"OFF"}
10:46:44 MQT: stat/EspGarden2/POWER2 = OFF
10:46:44 MQT: stat/EspGarden2/RESULT = {"POWER3":"OFF"}
10:46:44 MQT: stat/EspGarden2/POWER3 = OFF
10:46:44 MQT: stat/EspGarden2/RESULT = {"POWER4":"OFF"}
10:46:44 MQT: stat/EspGarden2/POWER4 = OFF
10:46:52 MQT: stat/EspGarden2/RESULT = {"POWER1":"OFF"}
10:46:52 MQT: stat/EspGarden2/POWER1 = OFF
10:46:52 MQT: stat/EspGarden2/RESULT = {"POWER1":"OFF"}
10:46:52 MQT: stat/EspGarden2/POWER1 = OFF
10:47:45 MQT: stat/EspGarden2/RESULT = {"POWER1":"OFF"}
10:47:45 MQT: stat/EspGarden2/POWER1 = OFF
10:47:45 MQT: stat/EspGarden2/RESULT = {"PulseTime2":"75 (Active 75)"}
10:47:51 MQT: stat/EspGarden2/RESULT = {"POWER2":"ON"}
10:47:51 MQT: stat/EspGarden2/POWER2 = ON
10:47:51 MQT: stat/EspGarden2/RESULT = {"POWER1":"OFF"}
10:47:51 MQT: stat/EspGarden2/POWER1 = OFF
10:47:51 MQT: stat/EspGarden2/RESULT = {"POWER3":"OFF"}
10:47:51 MQT: stat/EspGarden2/POWER3 = OFF
10:47:51 MQT: stat/EspGarden2/RESULT = {"POWER4":"OFF"}
10:47:51 MQT: stat/EspGarden2/POWER4 = OFF
10:47:59 MQT: stat/EspGarden2/RESULT = {"POWER2":"OFF"}
10:47:59 MQT: stat/EspGarden2/POWER2 = OFF
10:47:59 MQT: stat/EspGarden2/RESULT = {"POWER2":"OFF"}
10:47:59 MQT: stat/EspGarden2/POWER2 = OFF

Hi, cause pulsetime script is not correct and @klogg is going to fix it.
For duration bigger than 11 seconds, pulsetime code must be set as: 100 + (minutes * 60) + 15 where:

Minutes is for you 1 in the example
15 are seconds decided by klogg
100 must be add by pulsetime docs.

Try to edit the klogg script where he use pulsetime add a 100 to calculation

This must be work for 1minute (you log must be show PulseTime1":"175)

For times bigger than 1 minutes I think TELEPERIOD also need to be set as same duration as PULSETIME

I will try, but it doesn’t work neither if I comment the pulsetime script

  # - service: script.set_sonoff_pulsetime
  #   data_template:
  #     cycle: '{{ cycle }}'
  #     zone: '{{ zone }}'

I’ve commented out this, and I still get same result.
Really strange!!!

That is because it is still set on the Sonoff itself. I never turn Pulsetime off in the code. It is not necessary to do so.

I will fix the pulsetime size so then you can run it again.

As for the Master Control Switch, yes it was just added for my own peace of mind to stop the system starting in Winter by accident! It doesn’t currently do much else. I could look into making it more useful.

In the mean time to stop a cycle you can use the buttons.

image

EDIT: @itajackass I just looked into Teleperiod and found this:

Starting with Tasmota 6.1.1.12 Sleep ≠ 0 has no impact on real time related commands like Uptime, Delay, PulseTime, TelePeriod and Blinktime.

So, so long as your Tasmota version is at the right level it will work. (The default for sleep is 50)

It’s enough…

I didn’t try as a stop button!

1 Like

When I added those buttons Lovelace had no option to change the colour or icon based on the state. I am not sure if things have changed but I will check…

Ok, I have made a new update…

It is only small, one line (and the comments), I have updated GitHub but if you want to just edit your yaml it is here:

  #========================================================================
  #=== Set Sonoff PULSETIME to 30 seconds longer than the zone runtime
  #=== is passed:
  #===   {{ cycle }}
  #===   {{ zone }}
  #===
  #=== This acts as a fail safe in the event of any communication failure
  #=== between HA and the Sonoff. The Sonoff will switch off under its own
  #=== control so closing the valve.
  #===
  #=== Note: From the Tasmota wiki, for a Pulsetime greater than 11 seconds
  #===       it should be set to 100 + (minutes * 60)
  #========================================================================
  set_sonoff_pulsetime:
    sequence:
      - service: mqtt.publish
        data_template:
          topic: >
            sonoff4ch01/cmnd/pulsetime{{ zone }}
          payload: >
            {% set payload = states('input_number.cycle' + cycle + '_zone' + zone + '_duration')  | int %}
            {% set payload = 100 + (payload * 60) + 30 %}
            {{ payload }}

I have tried it on a spare Sonoff basic but not yet on the 4ch, although I see no reason for it not to work. Testing is not so easy for me as I have everything installed with water in the system!

Let me know how you get on.

1 Like

I think icon_template is what you are looking for

Unfortunately you can’t template the icon of an input Boolean. The Lovelace button is very restrictive and whilst there is a custom button it is no longer maintained and I am hoping its features will make it into the core Lovelace soon.

Thanks @klogg

I’ve tried like this and it works on a 1 min as well as on a 8min duration

        {% set payload = (payload * 60) + 100 %}

I’m on a Nodemcu connected to 4 relay board

1 Like

Now last thing is replace the smartweather rain sensor.
I can get the data from Netatmo Public data from a station near me, but you’re also using a data from yesterday, that Netatmo AFAIK does not provide.

Is there another way to collect the today data and at the end of the day put in a yesterday entity?

Thanks

PS: Until now I was using a Nodered flows, inspired from others and customized to my needs. That was working fine.
What I was always thinking of is to store the ON/OFF relay command inside Tasmota as rules, so that if there is a wifi connection loss for any reason, the Tasmota will turn off anyway the relay.

I’ve already set that on System#Boot all the relays goes off.

Hi @klogg

strange behaviour.

49

If I set the schedule at 12:00 I get “Next scheduled run time” at 14:00

What can I check?

Thanks

Does it always show 2 hours out? My first guess would be that it might be something to do with time zones as it works for me.
image

To be honest working with times in Python is a bit of struggle for me now let alone when I wrote this and was first learning it!! If I get a chance I’ll look into it but no promises that it will be soon - I’m not sure how to easily test it too.

1 Like

I live in Italy and now there is Daylight Saving, so plus two hours from GMT.
Maybe this is the reason…