Skip to content

Commit

Permalink
Fix YAML lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasnicolaas committed Nov 12, 2024
1 parent 0da7ded commit 9396e56
Showing 1 changed file with 57 additions and 56 deletions.
113 changes: 57 additions & 56 deletions blueprints/automation/rotilho/trv_calibrator.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
blueprint:
name: TRV Calibrator
description: Calibrate your TRV using an external sensor
Expand All @@ -8,17 +9,17 @@ blueprint:
selector:
entity:
domain:
- climate
- climate
multiple: false
temperature_sensor:
name: Temperature Sensor
description: Sensor used to calibrate your TRV
selector:
entity:
domain:
- sensor
- sensor
device_class:
- temperature
- temperature
multiple: false
trv_calibration_number:
name: TRV Calibration Entity
Expand All @@ -27,9 +28,9 @@ blueprint:
selector:
entity:
domain:
- number
- number
device_class:
- temperature
- temperature
multiple: false
source_url: https://github.com/rotilho/home-assistant-blueprints/blob/main/trv_calibrator.yaml
mode: restart
Expand All @@ -38,56 +39,56 @@ variables:
trv_calibration_number: !input trv_calibration_number
temperature_sensor: !input temperature_sensor
trigger:
- platform: state
entity_id: !input trv
for:
hours: 0
minutes: 0
seconds: 0
- platform: state
entity_id: !input trv_calibration_number
for:
hours: 0
minutes: 0
seconds: 0
- platform: state
entity_id: !input temperature_sensor
for:
hours: 0
minutes: 0
seconds: 0
- platform: state
entity_id: !input trv
for:
hours: 0
minutes: 0
seconds: 0
- platform: state
entity_id: !input trv_calibration_number
for:
hours: 0
minutes: 0
seconds: 0
- platform: state
entity_id: !input temperature_sensor
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: template
value_template: '{{ state_attr(trv, "current_temperature") != None }}'
- condition: template
value_template: '{{ states(trv_calibration_number) != "unavailable" and states(trv_calibration_number)
!= "unknown" }}'
- condition: template
value_template: '{{ states(temperature_sensor) != "unavailable" and states(temperature_sensor)
!= "unknown" }}'
- condition: template
value_template: '{{ state_attr(trv, "current_temperature") != None }}'
- condition: template
value_template: '{{ states(trv_calibration_number) != "unavailable" and states(trv_calibration_number)
!= "unknown" }}'
- condition: template
value_template: '{{ states(temperature_sensor) != "unavailable" and states(temperature_sensor)
!= "unknown" }}'
action:
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: number.set_value
target:
entity_id: !input trv_calibration_number
data:
value: "{% set room_temperature = states(temperature_sensor) | float %} {% set
trv_temperature = state_attr(trv, \"current_temperature\") | float(0) %}\n{%
set trv_calibration = states(trv_calibration_number) | float %} {% set trv_calibration_min
= state_attr(trv_calibration_number, \"min\") | float(-5) %} {% set trv_calibration_max
= state_attr(trv_calibration_number, \"max\") | float(5) %} {% set trv_calibration_step
= state_attr(trv_calibration_number, \"step\") | float(1) %}\n{% set step =
trv_calibration_step | string %}\n{% if step.split(\".\") | length > 1 -%}\n
\ {% set trv_calibration_step_decimals = step.split(\".\")[1] | length %}\n{%-
else -%}\n {% set trv_calibration_step_decimals = 0 %}\n{%- endif %}\n\n{%
set new_trv_calibration = room_temperature - trv_temperature + trv_calibration
%} {% set new_trv_calibration_bounded = [ [ (new_trv_calibration - new_trv_calibration
% trv_calibration_step) | round(trv_calibration_step_decimals), trv_calibration_min
] | max, trv_calibration_max ] | min %}\n{% if new_trv_calibration_bounded <
trv_calibration - trv_calibration_step or trv_calibration + trv_calibration_step
< new_trv_calibration_bounded -%}\n {{ new_trv_calibration_bounded }}\n{%-
else -%}\n {{ states(trv_calibration_number) }}\n{%- endif %}"
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: number.set_value
target:
entity_id: !input trv_calibration_number
data:
value: "{% set room_temperature = states(temperature_sensor) | float %} {% set
trv_temperature = state_attr(trv, \"current_temperature\") | float(0) %}\n{%
set trv_calibration = states(trv_calibration_number) | float %} {% set trv_calibration_min
= state_attr(trv_calibration_number, \"min\") | float(-5) %} {% set trv_calibration_max
= state_attr(trv_calibration_number, \"max\") | float(5) %} {% set trv_calibration_step
= state_attr(trv_calibration_number, \"step\") | float(1) %}\n{% set step =
trv_calibration_step | string %}\n{% if step.split(\".\") | length > 1 -%}\n
\ {% set trv_calibration_step_decimals = step.split(\".\")[1] | length %}\n{%-
else -%}\n {% set trv_calibration_step_decimals = 0 %}\n{%- endif %}\n\n{%
set new_trv_calibration = room_temperature - trv_temperature + trv_calibration
%} {% set new_trv_calibration_bounded = [ [ (new_trv_calibration - new_trv_calibration
% trv_calibration_step) | round(trv_calibration_step_decimals), trv_calibration_min
] | max, trv_calibration_max ] | min %}\n{% if new_trv_calibration_bounded <
trv_calibration - trv_calibration_step or trv_calibration + trv_calibration_step
< new_trv_calibration_bounded -%}\n {{ new_trv_calibration_bounded }}\n{%-
else -%}\n {{ states(trv_calibration_number) }}\n{%- endif %}"

0 comments on commit 9396e56

Please sign in to comment.