Hello everyone!
I’ve been trying to adapt a blueprint I found in the community for multi-speed fan control based on temperature. Here’s the original blueprint: Multi-speed Fan Control based on Temperature.
However, I’m using a Tuya controller which operates on a scale from 0 to 1000, instead of the standard percentage.
Here’s the error I encountered:
Message malformed: must contain at least one of below, above.
My current configuration is as follows:
trigger:
- type: temperature
platform: device
device_id: 7892b03118d30b2c80076a5d1f6f9238
entity_id: 92f8d765c7517aa66e988b81356a7875
domain: sensor
condition: []
action:
- device_id: 28a993347889f1d3652d3c210f87d2a1
domain: number
entity_id: c331e7c2333c163027cfd10807f5ecd2
type: set_value
And all code look like that
blueprint:
name: Auto fan speed (Number Domain)
description: Temperature based Auto fan control.
domain: automation
input:
fan_switch:
name: Fan (Number Domain)
description: The fan you wish to speed control using a number domain.
selector:
entity:
domain: number
min_fan_speed:
name: Minimum Fan Speed
description: Set the minimum speed at which your fan is still on.
default: 16
selector:
number:
min: 1.0
max: 1000.0
mode: slider
step: 1.0
unit_of_measurement: ""
max_fan_speed:
name: Maximum Fan Speed
description: Set the maximum speed for your fan.
default: 1000
selector:
number:
min: 1.0
max: 1000.0
mode: slider
step: 1.0
unit_of_measurement: ""
high_temp_value:
name: What temperature would you like the fan to run at maximum speed.
description: Set the high temperature sensor value.
default: 31
selector:
number:
min: 15
max: 40.0
step: 1.0
mode: slider
low_temp_value:
name: What temperature would you like the fan to run at minimum speed.
description: Set the low temperature sensor value.
default: 23
selector:
number:
min: 15
max: 40.0
step: 1.0
mode: slider
off_temp_value:
name: What temperature would you like the fan to turn off.
description: Set the fan OFF temperature sensor value.
default: 21.5
selector:
number:
min: 15
max: 40.0
step: 1.0
mode: slider
temp_sensor:
name: Temperature Sensor
description: Enter your temperature sensor.
selector:
entity:
domain: sensor
device_class: temperature
multiple: false
variables:
low_temp_value: !input low_temp_value
off_temp_value: !input off_temp_value
high_temp_value: !input high_temp_value
min_fan_speed: !input min_fan_speed
max_fan_speed: !input max_fan_speed
temp_sensor: !input temp_sensor
fan_switch: !input fan_switch
current_temp: "{{ states(temp_sensor) | float }}"
temp_range: "{{ high_temp_value | float - low_temp_value | float }}"
fan_range: "{{ max_fan_speed | float - min_fan_speed | float }}"
percent_per_degree: "{{ fan_range / temp_range }}"
deg_above_min: "{{ current_temp | float - low_temp_value | float }}"
set_fan_speed: "{{ min_fan_speed | float + (deg_above_min * percent_per_degree) }}"
trigger:
- platform: state
entity_id: !input temp_sensor
- platform: time_pattern
minutes: "/5"
condition:
- condition: numeric_state
entity_id: !input temp_sensor
above: !input off_temp_value
action:
- choose:
- conditions:
- condition: template
value_template: "{{ current_temp | float > high_temp_value | float }}"
sequence:
- service: number.set_value
target:
entity_id: !input fan_switch
data:
value: !input max_fan_speed
- conditions:
- condition: template
value_template: "{{ current_temp | float <= off_temp_value | float }}"
sequence:
- service: number.set_value
target:
entity_id: !input fan_switch
data:
value: 0
- conditions:
- condition: template
value_template: "{{ current_temp | float > low_temp_value | float and current_temp | float <= high_temp_value | float }}"
sequence:
- service: number.set_value
target:
entity_id: !input fan_switch
data:
value: "{{ set_fan_speed }}"
mode: single
sorry for my english i’m french guy …
Would appreciate if someone could help identify where the issue is and how to adapt the blueprint properly for my Tuya controller.
Thank you in advance for your assistance!