I tried to enter name_template:
in rest
sensor.
But it gives error that name_template:
is not supported, but here RESTful Sensor - Home Assistant it states that it should be supported.
In configuration.yaml
i have line rest: !include configurations/rest.yaml
and in rest.yaml
i have
- resource_template: >-
{% if states("device_tracker.innosilicontechnology_ltd") == 'home' %}
http://192.168.0.46/cgi-bin/api.py
{% else %}
http://192.168.0.143:8123/local/community/innosilicon/api.json
{% endif %}
headers:
Content-Type: application/json
scan_interval: 60
timeout: 180
method: GET
sensor:
## DEVS ##
- name: "Innosilicon A6 HB0"
unique_id: unique_id_innosilicon_a6_hb0
unit_of_measurement: "MH/s"
state_class: "measurement"
value_template: >-
{% if value_json.DEVS[0]['MHS 5s'] is defined %}
{{ value_json.DEVS[0]['MHS 5s'] }}
{% else %}
{{ this.state }}
{% endif %}
What i would like to have, is to sensor to change its name depending on JSON message.
I think it should be like this name_template: "Innosilicon A6 HB{{ value_json.DEVS[0]['ASC'] }}"
but it is not accepted.
Do i need to move my code under sensor:
instead of rest:
?