I have the following block of yaml in my automations.yaml file.
- alias: "Update M120T with Water Tank 1 % (filtered)"
id: update_m120t_tank1_percent_filtered
mode: queued
trigger:
- platform: state *String does not match the pattern of "LEGACY_SYNTAX^".*
entity_id: sensor.water_tank_1_percent_full
for:
seconds: 10
condition:
- condition: template
value_template: >
{% set old = trigger.from_state.state | float(0) %}
{% set new = trigger.to_state.state | float(0) %}
{% set delta = (new - old) | abs %}
{{ delta >= 0.5 }}
action:
- service: modbus.write_register *String does not match the pattern of "LEGACY_SYNTAX^".*
target: {} # optional, keeps schema happy
data:
hub: "M120T water"
slave: 6
address: 110
value: "{{ (states('sensor.water_tank_1_percent_full') | float(0) ) | round(0) }}"
For context, I have a modbus TCP remote IO device with both analog and digital IO. I presently read my water tank level by means of a submersible differential pressure sensor which outputs 4-20mA to an analog input of the device. I read the raw data and manipulate that in the sensor definition to derive the tank volume in liters and tank % full.
I also have a small modbus RS485 LED display module mounted out at the tank that displays the tank level in a range of 0-100 %. The automation yaml pasted above writes the tank level % value to the display and works satisfactorily.
Iâm probably overthinking things but the yaml checking function of Studio Code Server flags the error âString does not match the pattern of âLEGACY_SYNTAX^â.â
This is flagged at the "platform state: " and "-service: modbus.write_register " lines (twice) I have added these error flags in the yaml quoted above.
Despite these errors when I check the yaml in Developer Tools, no problems are identified and the yaml reloads satisfactorily.
Can anyone shed light on this puzzle? It would also be good to be able to understand the Legacy and New automation formats implied by this error message.