Last active
August 26, 2024 08:27
-
-
Save boozeman/714659a0c4007525c94811a38045d050 to your computer and use it in GitHub Desktop.
Home assistant automation Action to control DS3502 Digital Potentiometer with somekind of Map-Float-Function. There's 3 Helpers, Fan Min Temp, Max Temp and Fan max (0-127)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: mqtt.publish | |
data: | |
topic: cmnd/Greenhouse1/wiper1 | |
qos: "0" | |
retain: true | |
payload: >- | |
{% set greenhouse_temp = states('sensor.greenhouse1_ec_fan_control_temperature') |float %} | |
{% if greenhouse_temp <24.0 %} 0 | |
{% else %} | |
{% set temp_min = states('input_number.ec_fan_temp_min') |float %} | |
{% set temp_max = states('input_number.ec_fan_temp_max') |float %} | |
{% set ec_min = 13 |int %} | |
{% set ec_max = states('input_number.ec_fan_max') |int %} | |
{% if greenhouse_temp < temp_max %} | |
{% set Wiper = ((temp_max - greenhouse_temp) / (temp_max - temp_min)) * (ec_min - ec_max) + ec_max %} | |
{{ Wiper |int }} | |
{%else %} | |
125 | |
{% endif %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment