usda-hass-config/tcp_sensors/precision_scale.yaml

19 lines
480 B
YAML

platform: tcp
host: 192.168.1.21
port: 23
payload: ""
name: "Precision Scale"
scan_interval:
seconds: 0.3
value_template: >-
{% if not value | contains('M') %}
{% set temp_value = value | regex_findall_index('\d+\.\d+(?=oz)') | float %}
{% if value | contains('-') %}
{% set temp_value = temp_value * -1 %}
{% endif %}
{{ temp_value | round(4) }}
{% else %}
{{ states("sensor.precision_scale") | round(4) }}
{% endif %}
unit_of_measurement: "oz"