Untitled
unknown
plain_text
2 years ago
1.0 kB
5
Indexable
sensor:
- platform: ultrasonic
trigger_pin: GPIO1
echo_pin: GPIO2
name: "Výška hladiny"
id: hladina
update_interval: 5s
unit_of_measurement: "m"
accuracy_decimals: 2
filters:
- lambda: |-
float max_height = 5.0; // Maximálna výška hladiny
float well_diameter = 1.0; // Priemer studne
float well_depth = 6.0; // Hĺbka studne
float sensor_height = 5.0; // Výška, na ktorej je umiestnené čidlo
float distance = id(hladina).state;
// Výpočet výšky hladiny na základe vzdialenosti meranej čidlom
float water_level = max_height - (well_depth - (sensor_height - distance) * (well_depth / well_diameter));
// Prepočet na objem v litroch
float well_volume = 3.14159 * (well_diameter / 2) * (well_diameter / 2) * well_depth;
float water_volume = (water_level / well_depth) * well_volume;
return water_volume;
unit_of_measurement: "l"
accuracy_decimals: 2Editor is loading...