What do you get if you put the template in the Dev Tools Template page?
You have two ‘unknown’ switches.
I think that might be stopping it work.
If that I am right then you need to remove
input_text.irrigation_zone7_switch_entity_id
and
input_text.irrigation_zone8_switch_entity_id
from `garden_globals_zones.yaml
Or you can try replacing the loop with this:
{% for switch_name in states.input_text if switch_name.object_id.startswith('irrigation_zone') and
switch_name.object_id.endswith('switch_entity_id') -%}
{% if states(switch_name.entity_id) != 'unknown' or
states(switch_name.entity_id) != 'none' -%}
{{ 'switch.irrigation_dummy_switch' ~ loop.index }}
{%- else %}
{{ states(switch_name.entity_id) }}
{%- endif %}
{%- if not loop.last %}, {% endif %}
{%- endfor %}
Which might also fix it as it will always return a valid list of switches even if they don’t exist.
So, I tried this template and there is the result, which does not seem correct.
So, I create this new template:
{% for switch_name in states.input_text if 'switch_entity_id' in switch_name.entity_id
and states(switch_name.entity_id) != 'unknown' and states(switch_name.entity_id) != 'none' -%}
{{ states(switch_name.entity_id) }}
{%- if not loop.last %}, {% endif %}
{%- endfor %}
and, this is the result:
But by running the cycle without adjusting it to the conditions, the valves do not turn off.
In the log I get the error:
- Irrigation System Reset: Error executing script. Invalid data for call_service at pos 2: not a valid value for dictionary value @ data[‘entity_id’]
Sorry that is a typo left over from my testing…
Should be…
{% if states(switch_name.entity_id) == 'unknown' or
states(switch_name.entity_id) == 'none' -%}
Regarding PulseTime.
I have just seen this thread which shows how to use a PulseTime equivalent in ESPHome. This means I will be removing the use of a Sonoff switch to power the the ESP32 and Relay Board as it looks like it is not necessary.
If by any chance this will cause you a problem I suggest you make sure you have a copy of the code that uses the Sonoff before I remove it.
hi @klogg, these days I have solved many things and now it works, I have also added pulsetime in each valve. Today, however, I get this error that I can’t solve, I found a post where it happened to you, how did you solve it?
Hi @klogg,
I’m using your garden irrigation (v1 - as i understand) since last summer and it worked flawlessly - so thanks a lot for making my garden and wife happy
One of the last HA updates seems to have broken one tiny bit of the configuration, resulting in the following error.
When starting one of the cycles, “Zone being watered” will switch to “Initialising…” and remains there without switching pump or valves.
Log Details (ERROR)
Logger: homeassistant.components.automation
Source: helpers/service.py:378
Integration: Automation (documentation, issues)
First occurred: 9:03:11 PM (2 occurrences)
Last logged: 9:03:11 PM
Irrigation Failsafe - master control switch: Error executing script. Unexpected error for call_service at pos 1: 'switch.zone1_valve'
Irrigation Failsafe - HA start: Error executing script. Unexpected error for call_service at pos 1: 'switch.zone1_valve'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 154, in _async_step
self, f"_async_{cv.determine_script_action(self._action)}_step"
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_call_service_step
*self._prep_call_service_step(), blocking=True, context=self._context
File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 86, in async_handle_turn_service
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
self._platforms.values(), func, call, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 378, in entity_service_call
entity_ids.remove(entity.entity_id)
KeyError: 'switch.zone1_valve'
I followed the changes for 0.103 posted by @Barmalej, haven’t touched anything in the configuration since last summer - sadly the error remains ;-(
Is there perhaps another change, i have missed?
Thanks in advance!!
Not that I am aware of and I am still using v1 until I have v2 finalised (mostly waiting to configure the hardware).
Your error seess to be pointing to the failsafe scripts which is a bit strange if you say it is happening when you try to runa cycle. Also the last line of the error log is
KeyError: 'switch.zone1_valve'
I am not sure exactly what that means but I assume your switches still have the same names?
I don’t recognise the error. Can you link the post where I had it so that I can remind myself?
Ah yes…
I never found a solution and RomRider advised that it was nothing he could fix. It wasn’t actually causing any problems except to generate the error and only when I did a refresh.
What version of HA are you on? I don’t recall seeing that error recently so maybe it was fixed in 108?
(Although I may just have not noticed the error in my log)
I’m running Hassio 108.5, but this error also occurs on 108.4. it arrived so suddenly this morning and I can’t understand how to solve it
The problem is that error cause this:
What version were you on before 108.4?
I am on 108.3 and it seems to work ok for me.
I wonder if something changed between 108.3 and 108.4?
i didn’t know what to do, i took another sd and i restored the backup two days ago when i didn’t have this problem, it was on 108.3 and it worked. Then I updated to 108.5 and it worked anyway. In my opinion something had become corrupt, but I don’t know
That sounds very strange indeed.
Let me know if it happens again.
For the record, I still get the error in the log if I refresh as per the original post but it doesn’t seem to be causing me any problems.
At some point I might look into it a bit deeper and see if I can rework the Lovelace yaml to stop it happening.
Dear Klogg, I’m quite new on hass and meanwhile I had a need to Smart plug
my garden; i found your project very interesting.
I’ve installed the code on my Qnap Docker 0.65 and on Raspberry 0.108, I
found an error related to the automation
“following components and platforms could not be set up: automation”
Do you have the possibility to share the main config yaml
file (configuration. yaml / customize / groups)
to have a look either how you realize the beautiful user interface and to understand if I make some error on those main files ?
Thanks
I would also like to know how to implement it.
I guess it should be done by custom lovelace in configuration.yaml
lovelace:
mode: yaml
…
but what else should be there and where to place your folders in /config.
Thanks
If I understand your problems correctly you need to understand that this is a ‘package’. Packages are documented here. In a nutshell this allows you to keep everything to do with one function (in this case, Irrigation) in a seperate folder all of its own.
So in this case, once you have defined packages in your config (following the docs) it should be clear how everything in the folder packages/garden_v2
should be copied to your config
. These files are the ones that do the ‘work’.
As for Lovelace, yes, I use mode: yaml
.
It might not be clear but the views
folder is for v1. (I will change the Github at some point to make that clearer.)
I hope that helps.
My case is not package. I am using v1 since last year and btw perfect code
I have made all the cards manually and want to use your lovelace design now with v2. I am struggling how to do it. Where should I copy lovelace folder and what should I add under mode: yaml in configuration.yaml in order to work.
Thanks