add sensors via digital analog converter;
This commit is contained in:
@@ -8,6 +8,7 @@ esp32:
|
||||
type: arduino
|
||||
|
||||
logger:
|
||||
hardware_uart: USB_SERIAL_JTAG
|
||||
|
||||
api:
|
||||
encryption:
|
||||
@@ -26,17 +27,28 @@ wifi:
|
||||
captive_portal:
|
||||
|
||||
i2c:
|
||||
- id: bus_a
|
||||
- id: bus_relay
|
||||
sda: 8
|
||||
scl: 18
|
||||
scan: true
|
||||
frequency: 400kHz
|
||||
|
||||
- id: bus_ads
|
||||
sda: 13
|
||||
scl: 14
|
||||
scan: true
|
||||
frequency: 100kHz
|
||||
|
||||
pcf8574:
|
||||
- id: pcf8574_hub_out_1
|
||||
i2c_id: bus_a
|
||||
i2c_id: bus_relay
|
||||
address: 0x24
|
||||
|
||||
ads1115:
|
||||
- id: ads1115_hub
|
||||
i2c_id: bus_ads
|
||||
address: 0x48
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
name: "Bewässerung Hochbeet 1"
|
||||
@@ -46,6 +58,7 @@ switch:
|
||||
number: 4
|
||||
mode: OUTPUT
|
||||
inverted: true
|
||||
restore_mode: ALWAYS_OFF
|
||||
icon: "mdi:sprinkler-variant"
|
||||
|
||||
- platform: gpio
|
||||
@@ -56,6 +69,7 @@ switch:
|
||||
number: 5
|
||||
mode: OUTPUT
|
||||
inverted: true
|
||||
restore_mode: ALWAYS_OFF
|
||||
icon: "mdi:sprinkler-variant"
|
||||
|
||||
- platform: gpio
|
||||
@@ -66,6 +80,7 @@ switch:
|
||||
number: 6
|
||||
mode: OUTPUT
|
||||
inverted: true
|
||||
restore_mode: ALWAYS_OFF
|
||||
icon: "mdi:sprinkler-variant"
|
||||
|
||||
- platform: gpio
|
||||
@@ -76,6 +91,7 @@ switch:
|
||||
number: 7
|
||||
mode: OUTPUT
|
||||
inverted: true
|
||||
restore_mode: ALWAYS_OFF
|
||||
icon: "mdi:sprinkler-variant"
|
||||
|
||||
binary_sensor:
|
||||
@@ -127,53 +143,54 @@ binary_sensor:
|
||||
- delayed_on: 10ms
|
||||
icon: "mdi:water-opacity"
|
||||
|
||||
ads1115:
|
||||
- address: 0x48
|
||||
|
||||
sensor:
|
||||
- platform: ads1115
|
||||
ads1115_id: ads1115_hub
|
||||
multiplexer: A0_GND
|
||||
gain: 6.144
|
||||
gain: 4.096
|
||||
resolution: 16_BITS
|
||||
name: "Feuchtigkeitsmessung V Hochbeet 1"
|
||||
id: b4_sensor1
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 3
|
||||
state_class: measurement
|
||||
icon: "mdi:flash"
|
||||
|
||||
- platform: ads1115
|
||||
ads1115_id: ads1115_hub
|
||||
multiplexer: A1_GND
|
||||
gain: 6.144
|
||||
gain: 4.096
|
||||
resolution: 16_BITS
|
||||
name: "Feuchtigkeitsmessung V Hochbeet 2"
|
||||
id: b4_sensor2
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 3
|
||||
state_class: measurement
|
||||
icon: "mdi:flash"
|
||||
|
||||
- platform: ads1115
|
||||
ads1115_id: ads1115_hub
|
||||
multiplexer: A2_GND
|
||||
gain: 6.144
|
||||
gain: 4.096
|
||||
resolution: 16_BITS
|
||||
name: "Feuchtigkeitsmessung V Hochbeet 3"
|
||||
id: b4_sensor3
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 3
|
||||
state_class: measurement
|
||||
icon: "mdi:flash"
|
||||
|
||||
- platform: ads1115
|
||||
ads1115_id: ads1115_hub
|
||||
multiplexer: A3_GND
|
||||
gain: 6.144
|
||||
gain: 4.096
|
||||
resolution: 16_BITS
|
||||
name: "Feuchtigkeitsmessung V Hochbeet 4"
|
||||
id: b4_sensor4
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 3
|
||||
state_class: measurement
|
||||
@@ -186,14 +203,14 @@ sensor:
|
||||
accuracy_decimals: 0
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
icon: "mdi:water-percent"
|
||||
lambda: |-
|
||||
const float wet_voltage = 1.20;
|
||||
const float dry_voltage = 2.70;
|
||||
float v = id(b4_sensor1).state;
|
||||
if (isnan(v)) return NAN;
|
||||
float p = (dry_voltage - v) * 100.0 / (dry_voltage - wet_voltage);
|
||||
float p = (dry_voltage - v) * 100.0f / (dry_voltage - wet_voltage);
|
||||
if (p < 0) p = 0;
|
||||
if (p > 100) p = 100;
|
||||
return p;
|
||||
@@ -205,14 +222,14 @@ sensor:
|
||||
accuracy_decimals: 0
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
icon: "mdi:water-percent"
|
||||
lambda: |-
|
||||
const float wet_voltage = 1.20;
|
||||
const float dry_voltage = 2.70;
|
||||
float v = id(b4_sensor2).state;
|
||||
if (isnan(v)) return NAN;
|
||||
float p = (dry_voltage - v) * 100.0 / (dry_voltage - wet_voltage);
|
||||
float p = (dry_voltage - v) * 100.0f / (dry_voltage - wet_voltage);
|
||||
if (p < 0) p = 0;
|
||||
if (p > 100) p = 100;
|
||||
return p;
|
||||
@@ -224,14 +241,14 @@ sensor:
|
||||
accuracy_decimals: 0
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
icon: "mdi:water-percent"
|
||||
lambda: |-
|
||||
const float wet_voltage = 1.20;
|
||||
const float dry_voltage = 2.70;
|
||||
float v = id(b4_sensor3).state;
|
||||
if (isnan(v)) return NAN;
|
||||
float p = (dry_voltage - v) * 100.0 / (dry_voltage - wet_voltage);
|
||||
float p = (dry_voltage - v) * 100.0f / (dry_voltage - wet_voltage);
|
||||
if (p < 0) p = 0;
|
||||
if (p > 100) p = 100;
|
||||
return p;
|
||||
@@ -243,14 +260,14 @@ sensor:
|
||||
accuracy_decimals: 0
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
update_interval: 5s
|
||||
update_interval: 2s
|
||||
icon: "mdi:water-percent"
|
||||
lambda: |-
|
||||
const float wet_voltage = 1.20;
|
||||
const float dry_voltage = 2.70;
|
||||
float v = id(b4_sensor4).state;
|
||||
if (isnan(v)) return NAN;
|
||||
float p = (dry_voltage - v) * 100.0 / (dry_voltage - wet_voltage);
|
||||
float p = (dry_voltage - v) * 100.0f / (dry_voltage - wet_voltage);
|
||||
if (p < 0) p = 0;
|
||||
if (p > 100) p = 100;
|
||||
return p;
|
||||
|
||||
Reference in New Issue
Block a user