Hi, I do not know how to proceed. Each try ends in an error like: platform is invalid in modbus configuration.
Here is my modbus yaml, the first lines of 242:
The “nilan_operation_mode” presents five values 0 to 4. For all user this would be
easier to comprehend:
template:
value_template: >
{% if states('sensor.nilan_operation_mode') | int == 0 %}
"Wert ist undefiniert"
{% elif states('sensor.nilan_operation_mode') | int == 1 %}
"kühlen"
{% elif states('sensor.nilan_operation_mode') | int == 2 %}
"heizen"
{% elif states('sensor.nilan_operation_mode') | int == 3 %}
"entfeuchten"
{% elif states('sensor.nilan_operation_mode') | int == 4 %}
"Wasser aufheizen"
{% else %}
"Unbekannter Wert"
{% endif %}
This does not work.
I have already tried
platform: template → mapping error
platform: template → invalid configuration platform nor part of modbus …
I am mixed up with the position of sensors or sensor! There are a lot of opinions that there is only room for one sensors but where?
Before platform and after platform, HA ends always in configuration lets HA not start.
Both options ended up in a numerous shifting of code down the lines of template and then back shifting, so that it will at least work again.
Is there by the way a intelligent yaml editor which shifts the following code and vise versa?
not very clear how is your configuration.
I suppose you have split configuration so you include in your configuration.yaml for modbus via modbus: !include modbus.yaml , correct?
Then don’t you have a split configuration for templates? you included in configuration.yaml?
you included templates in the modbus.yaml?
I suggest you split the configuration for templates too.
The Idea for separating the template.yaml is very convenient.
There are no configuration errors. BUT.
The numbers from sensor.nilan_operation_mode will not change.
In the entities there is the new one from the template.yaml. But this entity says it does not exit.
Here are all yaml.files which should connect.
configuration.yaml
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# Load dashboard Editor
config_editor:
# Load modbus
template: !include template.yaml
modbus: !include nilan_test_02.yaml
# Load multiscrape
multiscrape: !include bayrol.yaml
logger:
default: info
logs:
homeassistant.components.modbus: debug
template.yaml
- sensor:
- name: Template_sensor
unique_id: TS01
state: >
{% set nilan = states("sensor.nilan_operation_mode") | float(0) %}
{% if nilan | int == 0 %}
"Wert ist undefiniert"
{% elif nilan | int == 1 %}
"kühlen"
{% elif nilan | int == 2 %}
"heizen"
{% elif nilan | int == 3 %}
"entfeuchten"
{% elif nilan | int == 4 %}
"Wasser aufheizen"
{% else %}
"Unbekannter Wert"
{% endif %}
availability: >
{{ states('sensor.nilan_operation_mode') | is_number }}
This helps you to see what is happening and testing your code without restarting everytime.
In template section you can write down the code and see what are the results, also what are the errors with some kind of suggestion.
By the way what are you controlling a cooling / heating control?
My german is not that good