Open markbergsma opened 5 months ago
I updated my Open AIR Valve ESPHome code to use the newer valve component to control using a single entity, as opposed to the old two entities. I replaced the old "number" and "cover" blocks by:
valve: - platform: template name: "Valve" id: airvalve icon: mdi:valve has_position: true optimistic: true lambda: |- if (id(my_stepper).target_position == 0) { return VALVE_CLOSED; } else { return id(airvalve).position; } open_action: - stepper.set_target: id: my_stepper target: 525 close_action: - stepper.set_target: id: my_stepper target: 0 position_action: then: - stepper.set_target: id: my_stepper target: !lambda |- if (pos <= 0.0) { return 0; } else if(pos >= 1.0) { return 525; } else if (pos > 0.0 && pos < 1.0) { int steps = id(valve_capacity_lookup_table)[pos * 100]; return steps; } else { return 0; }
I updated my Open AIR Valve ESPHome code to use the newer valve component to control using a single entity, as opposed to the old two entities. I replaced the old "number" and "cover" blocks by: