I’m trying out the new Sprinkler Controller component and having an issue right off. After writing to the ESP32 board (nodeMCU-32) for testing I’m finding that the entities created under sprinkler: are not being reported (showing up) in either the ESPhome Integration GUI or in HA’s own entities list. Only the GPIO platform switch entity is visible.
Solved: Deleted the new ESPhome device and restarted HA then recreated the ESPhome device with a new name. This time around I get the entities associated with the device appearing.
Additionally a ‘number: component’ is needed for each valve duration control and an overall run time multiplier if you want one.
Still looking for some help with the sprinkler component.
I have a front end GUI number slider working for the watering time multiplier fine, but I’m not sure how to use a similar thing for the individual valve run duration’s. I added a template number for the first valve run duration but it throws compiler errors due to me not really knowing how to load a value via the lambda (or at least that’s where I think I go wrong). If somebody can point out what I should be doing in the last code block to set the valve run duration it would be great…
Quick edit: I suspect since you have it as 1->120 that you are using minutes. The controller is expecting the value in seconds; you need the run_duration: to be !lambda “return x * 60;” to get the proper result.
Thanks guys, both of your code suggestions work and I have grabbed a bit of both. I didn’t understand how the lambda could access the x value without doing something to write it first. Shows that I don’t know much about the way lambdas work inside yaml, it’s all a bit abstract for an old dog like me.
This below is what will do the job. Now too work out a neat way to set the watering days via the frontend GUI and expand to eight valves.
CS80 you are right, I was trying to achieve minute increments not seconds in the run duration.
# Example configuration to set multiplier via number
number:
- platform: template
id: sprinkler_ctrlr_multiplier
name: "Sprinkler Controller Multiplier"
min_value: 1.0
max_value: 3.0
step: 0.1
mode: box
lambda: "return id(lawn_sprinkler_ctrlr).multiplier();"
set_action:
- sprinkler.set_multiplier:
id: lawn_sprinkler_ctrlr
multiplier: !lambda 'return x;'
# Example configuration to set valve run duration via number
- platform: template
id: sprinkler_valve_0_duration
name: "Front Lawn Duration"
min_value: 1
max_value: 120
step: 1.0
mode: box
lambda: "return id(lawn_sprinkler_ctrlr).valve_run_duration(0) / 60;"
set_action:
- sprinkler.set_valve_run_duration:
id: lawn_sprinkler_ctrlr
valve_number: 0
run_duration: !lambda "return x * 60;"