BoysenMike
(Mike Boysen Jurock)
1
Hello.
I have tried to search for solutions to get my attribute sensor working.
but I really can’t get the value I want.
Frist of all I use the eForsyning integration from HACS.
Here is the sensor list with attributes:
and I have marked the attribute I need to be shown.
Here is my template sensor:
- sensor:
- name: "Heat Price Actual Year"
state: '{{ states.sensor.eforsyning_amount_remaining.attributes["data"][1] }}'
if I do like this:
- sensor:
- name: "Heat Price Actual Year"
state: '{{ states.sensor.eforsyning_amount_remaining.attributes["data"] }}'
I get the whole list from the “data”:
can anyone here help me ?
tom_l
2
It’s json data not a list. Try this:
- sensor:
- name: "Heat Price Actual Year"
state: "{{ state_attr('sensor.eforsyning_amount_remaining', 'data').MWh-Price }}"
BoysenMike
(Mike Boysen Jurock)
3
Thank you tom_l.
but I have tried this once.
sensor:
- name: "Heat Price Actual Year"
state: "{{ state_attr('sensor.eforsyning_amount_remaining', 'data').MWh-Price }}"
but it makes it make the sensor: unknown
tom_l
4
What about:
sensor:
- name: "Heat Price Actual Year"
state: "{{ (state_attr('sensor.eforsyning_amount_remaining', 'data')|from_json).MWh-Price }}"
BoysenMike
(Mike Boysen Jurock)
5
still get same unavailable.
i do really not get why I can’t get the value, I think it should be possible as it is a attribute.
BoysenMike
(Mike Boysen Jurock)
6
No one here can help me out ?
Psmessaert
(psmessaert)
7
Somebody already a solution? I have the same issue…
tom_l
8
I wonder if it is the dash that is mucking things up. Try this:
- sensor:
- name: "Heat Price Actual Year"
state: "{{ state_attr('sensor.eforsyning_amount_remaining', 'data')['MWh-Price'] }}"
Psmessaert
(psmessaert)
9
For me it worked like this:
state: “{{ state_attr(‘sensor.eforsyning_amount_remaining’, ‘data’)[0].MWh-Price }}”
tom_l
10
Ah. there’s a list in there.
I wish the Dev Tools would not hide that.