I have a ADC measuring battery voltage, and create an analogue_threshold sensor from this.
My problem is this line:
binary_sensor.is_true: Septic_tank_12v_battery
The error is “Unable to find condition with the name ‘binary_sensor.is_true’”
Any help to fix this much appreciated
sensor:
- platform: adc
name: "${friendly_name} Battery Voltage"
pin: GPIO36 # VP pin ADC1_ch0
id: Septic_tank_12v_battery
update_interval: 30s
unit_of_measurement: "V"
accuracy_decimals: 2
attenuation: auto # 11db
filters:
- multiply: 4.5
binary_sensor:
- platform: analog_threshold
name: "Septic Tank Mains power FAILED"
sensor_id: Septic_tank_12v_battery
threshold:
upper: 13.0
lower: 12.5
filters:
- delayed_on: 60s
- delayed_off: 2s
# if battery voltage < 12.5V for > 1 minute then turn on alarm buzzer
on_state:
then:
- if:
condition:
binary_sensor.is_true: Septic_tank_12v_battery
then:
- switch.turn_on: alarm_piezo_relay
BTW, I did try a lambda function:
- platform: analog_threshold
name: "Septic Tank Mains power FAILED"
sensor_id: Septic_tank_12v_battery
threshold:
upper: 13.0
lower: 12.5
filters:
- delayed_on: 60s
- delayed_off: 2s
lambda: |-
if (id(Septic_tank_12v_battery).state = "true"){
id(alarm_piezio_relay).turn_off();
}
The error here is “[lambda] is an invalid option for [binary_sensor.analog_threshold]. Please check the indentation.”