diff --git a/device.yaml b/device.yaml deleted file mode 100644 index 3e19811..0000000 --- a/device.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# this is just a simple test device setup that's used to compile and test the examples - -esphome: - name: custom_components_test - -esp32: - board: esp32dev - framework: - type: esp-idf diff --git a/sthome-ut8.yaml b/sthome-ut8.yaml index 60671c0..a5735a4 100644 --- a/sthome-ut8.yaml +++ b/sthome-ut8.yaml @@ -18,6 +18,8 @@ substitutions: friendly_name: "sthome-ut8" MAX_SCHOOL_HOLIDAY_PERIODS: 12 BATTERY_INFO_TIMEOUT: 30 # 30 sec timeout + GEYSER_HEAT_IND_MIN: 20 + GEYSER_HEAT_IND_MAX: 70 esphome: name: "${name}" @@ -3309,19 +3311,22 @@ script: - id: set_heat_indicators parameters: - temp_bottom: double - temp_top: double + low_value: double + high_value: double then: - lambda: |- double led_on = 1.0; int led_count = 8; - double min_temp = 30.0; - double max_temp = 70.0; - double step_size = (max_temp - min_temp) / led_count; - double bottom_point = (temp_bottom - min_temp) / step_size; + double min_value = ${GEYSER_HEAT_IND_MIN}; + double max_value = ${GEYSER_HEAT_IND_MAX}; + if(low_value < min_value) { + low_value = min_value; + } + double step_size = (max_value - min_value) / led_count; + double bottom_point = (low_value - min_value) / step_size; int led_bot = static_cast(std::trunc(bottom_point)); double led_bot_int = 1.0 + led_bot - bottom_point; - double top_point = (temp_top - min_temp) / step_size; + double top_point = (high_value - min_value) / step_size; int led_top = static_cast(std::trunc(top_point)); double led_top_int = top_point - led_top; double led_0 = 0; @@ -3401,8 +3406,8 @@ script: id(led_geyser_temp4).turn_on().set_brightness(led_4).perform(); id(led_geyser_temp5).turn_on().set_brightness(led_5).perform(); id(led_geyser_temp6).turn_on().set_brightness(led_6).perform(); - id(led_geyser_temp7).turn_on().set_brightness(led_7).perform(); - //ESP_LOGI("geyser","bot: %f, top: %f 0: %0.2f 1: %0.2f 2: %0.2f 3: %0.2f 4: %0.2f 5: %0.2f 6: %0.2f 7: %0.2f ", temp_bottom, temp_top, led_0, led_1, led_2, led_3, led_4, led_5, led_6, led_7); + id(led_geyser_temp7).turn_on().set_brightness(led_7).perform(); + //ESP_LOGI("geyser","bot: %f, top: %f 0: %0.2f 1: %0.2f 2: %0.2f 3: %0.2f 4: %0.2f 5: %0.2f 6: %0.2f 7: %0.2f ", low_value, high_value, led_0, led_1, led_2, led_3, led_4, led_5, led_6, led_7); # do at 1 second intervals - check if geyser is on, and switch off if required - id: reset_geyser_relay