From 553af1196ffe9a000aca31b86a0c6dbc4fd874d4 Mon Sep 17 00:00:00 2001 From: reachableceo Date: Wed, 2 Sep 2026 15:13:02 -0500 Subject: [PATCH] =?UTF-8?q?fix(plant):=20DRAC=20template=20guards=20?= =?UTF-8?q?=E2=80=94=20multiline-safe=20regex,=20clean=20unavailable=20[#6?= =?UTF-8?q?25]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plant_snmp.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/plant_snmp.yaml b/packages/plant_snmp.yaml index 17bc718..4a475e5 100644 --- a/packages/plant_snmp.yaml +++ b/packages/plant_snmp.yaml @@ -271,8 +271,8 @@ sensor: unit_of_measurement: "°F" unique_id: pfv_tsys6_drac_ambient value_template: >- - {% set c = value | regex_findall('ambient_temp (\d+)') | first if value is match('ambient_temp') else none %} - {{ ((c | float * 9 / 5) + 32) | round(1) if c is not none else 'unknown' }} + {% set m = value | regex_findall('ambient_temp (\d+)') %} + {{ ((m[0] | float * 9 / 5) + 32) | round(1) if m | length > 0 }} - platform: snmp name: "PFV tsys7 DRAC inlet" @@ -286,8 +286,8 @@ sensor: unit_of_measurement: "°F" unique_id: pfv_tsys7_drac_inlet value_template: >- - {% set c = value | regex_findall('inlet_temp (\d+)') | first if value is match('inlet_temp') else none %} - {{ ((c | float * 9 / 5) + 32) | round(1) if c is not none else 'unknown' }} + {% set m = value | regex_findall('inlet_temp (\d+)') %} + {{ ((m[0] | float * 9 / 5) + 32) | round(1) if m | length > 0 }} - platform: snmp name: "PFV tsys7 DRAC exhaust" @@ -301,8 +301,8 @@ sensor: unit_of_measurement: "°F" unique_id: pfv_tsys7_drac_exhaust value_template: >- - {% set c = value | regex_findall('exhaust_temp (\d+)') | first if value is match('exhaust_temp') else none %} - {{ ((c | float * 9 / 5) + 32) | round(1) if c is not none else 'unknown' }} + {% set m = value | regex_findall('exhaust_temp (\d+)') %} + {{ ((m[0] | float * 9 / 5) + 32) | round(1) if m | length > 0 }} - platform: snmp name: "PFV tsys7 DRAC CPU1" @@ -317,7 +317,7 @@ sensor: unique_id: pfv_tsys7_drac_cpu1 value_template: >- {% set t = value | regex_findall('(?:^|\n)temp (\d+)') %} - {{ ((t[0] | float * 9 / 5) + 32) | round(1) if t | length > 0 else 'unknown' }} + {{ ((t[0] | float * 9 / 5) + 32) | round(1) if t | length > 0 }} - platform: snmp name: "PFV tsys7 DRAC CPU2" @@ -332,4 +332,4 @@ sensor: unique_id: pfv_tsys7_drac_cpu2 value_template: >- {% set t = value | regex_findall('(?:^|\n)temp (\d+)') %} - {{ ((t[1] | float * 9 / 5) + 32) | round(1) if t | length > 1 else 'unknown' }} + {{ ((t[1] | float * 9 / 5) + 32) | round(1) if t | length > 1 }}