HA-Irrigation-Version2
HA-Irrigation-Version2 copied to clipboard
ButtonCardJSTemplateError in General setting
Hello, I have a problem in principal card and I don't understand why.

I've searched everywhere but can't find a way to fix this problem.
What do you have in input_text.irrigation_external_sensor_controller_wifi
?
no, I didn't understand where it should be set
I have no controller connected in wifi, I cannot set any value
How do you control your valves?
What is the state of your input_text.irrigation_external_sensor_controller_wifi
?
Hi, I have same problem! Sorry Kloggy but I didn't understand your instruction!
@kloggy I had a similar problem, but I think I may have found the root of the problem: It's in the automation "\packages\garden_irrigation\irrigation_controller.yaml" "irrigation_set_default_controller_wifi_signal_sensor" which is setting the default controller Wi-Fi signal sensor value, to a sensor that does not exist within other configurations.
"input_text.irrigation_external_sensor_controller_wifi" set to "sensor.esphome_irrigation_controller_wifi_signal" if "irrigation_external_sensor_controller_wifi" is unknown or blank.
It seems that you are setting this value to "sensor.esphome_irrigation_controller_wifi_signal", which in my case I do not have. (I also assume this is the case for others, as it's not listed as a prerequisite). However a quick search shows it's used throughout your code, such as for Wi-Fi interruption notification.
Therefore the code you have in "\lovelace\garden_irrigation\settings\general\item_settings_controller_wifi_signal.yaml" to check to see if the state is undefined is never triggered, as you're always setting it to a state on boot, or if the entities ever set to 'blank' ('').
This produces the error "ButtonCardJSTemplateError: TypeError: Cannot read properties of undefined (reading 'state') in 'var statestr = (entity === undefined || entity.state === undefined) ? 'undefined' : entity.state;"
Which, if you refresh the webpage, causes the entire button to disappear.
I tested this theory by commenting out the code that does the checks, which did indeed bring back the pop-up button.
In summary, the checks you have in place to see if the entity is undefined, in "item_settings_controller_wifi_signal.yaml" are resulting in a error, as the entity is being defined to a predefined entity, by an automation, upon each boot.
There's definitely something not quite right with "item_settings_controller_wifi_signal.yaml".
If you accidentally sent the value of "input_text.irrigation_external_sensor_controller_wifi" to a invalid state, such as an entity that does not exist, or a typographical error, the custom button card will just disappear.
Induce an error
Button disappears.
Open the page on a new tab and you get the common error:
A quick and dirty solution to fix this issue for anyone else having a problem
In the file: "\lovelace\garden_irrigation\settings\general\item_settings_controller_wifi_signal.yaml"
Edit the 'name' and 'icon' lines to just state:
name: "Controller"
icon: mdi:wifi
Hi genestealer
thanks for your help!
Now I have same problem with "NEXT RUN: " ! :(
After following your advice I also have the same problem as Bubin1964. Does anyone have a suggestion on how to fix it?
Thank's to all