refactor config yaml into new files
This commit is contained in:
16
template_sensors/steinlite_moisture.yaml
Normal file
16
template_sensors/steinlite_moisture.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
- name: Steinlite Moisture Content
|
||||
unique_id: steinlite_moisture
|
||||
unit_of_measurement: "%"
|
||||
state: >
|
||||
{% set sensor_val = states('sensor.steinlite') %}
|
||||
{% set moisture_match = sensor_val.find('Moisture: ') %}
|
||||
{% if moisture_match != -1 %}
|
||||
{% set moisture_value = sensor_val[moisture_match + 10:sensor_val.find('%',moisture_match)] %}
|
||||
{% if moisture_value %}
|
||||
{% set state = moisture_value | float %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if state is defined %} {{ state }}
|
||||
{% else %} {{ this.state }}
|
||||
{% endif %}
|
||||
16
template_sensors/steinlite_temperature.yaml
Normal file
16
template_sensors/steinlite_temperature.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
- name: Steinlite Sample Temperature
|
||||
unique_id: steinlite_temperature
|
||||
unit_of_measurement: "°F"
|
||||
state: >
|
||||
{% set sensor_val = states('sensor.steinlite') %}
|
||||
{% set temp_match = sensor_val.find('Gr Temp: ') %}
|
||||
{% if temp_match != -1 %}
|
||||
{% set temp_value = sensor_val[temp_match + 9:sensor_val.find(' Deg F',temp_match)] %}
|
||||
{% if temp_value %}
|
||||
{% set state = temp_value | int %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if state is defined %} {{ state }}
|
||||
{% else %} {{ this.state }}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user