I’m using the Smart Irrigation integration to automate my yard irrigation. The integration uses weather data to calculate the amount of time to run each irrigation zone. I want to add an adjustment to the automation so that I can set the watering duration to be anywhere from 0-200% of the calculated time. I’m using an input number to set the percentage adjustment.
So, the integration will run each zone based on the state sensor.smart_irrigation_zone15_hourly_adjusted_run_time.
My adjustment entity is input_number.irrigation_duration_adjustment. It has an input range of 0-200. So I need to create a separate entity that is essentially sensor.smart_irrigation_zone15_hourly_adjusted_run_time * (input_number.irrigation_duration_adjustment/100) = New irrigation run time.
I’m having trouble getting the template syntax correct. I think what I have below is accurate, but when I hit “check configuration” I just get the spinning wheel of death. I’m hesitant to do a restart unless the config checks out.
States are always strings, so they need to be converted to either a float or integer before performing math functions with them. Also, your floats need defaults, there is an indent error, and it is preferred to use the states() format instead of the state object format:
Error loading /config/configuration.yaml: mapping values are not allowed here
in "/config/configuration.yaml", line 127, column 11
Line 127 is the ‘sensors:’ (under -platform: template) line
I also want to make sure the order of operations will work correctly. I need to divide input_number.irrigation_duration_adjustment by 100 then multiply the result by sensor.smart_irrigation_zone1_daily_adjusted_run_time