Need help to show more attributes info from sensor in lovelace

Hello!

I have an integration for Tibber, which allows me to view current power price, as well as current consumption. Tibber also let’s me view additional information, such as accumulated consumption and accumulated cost of the current day (see picture), which is pretty neat!

Skjermbilde|319x500

What I would like to do is to add this info for me to view as a glance-card in my overview-tab. Unfortunetly, I’m pretty new to the whole Home Assistant lifestyle, so I have no clue on how to get on about this. Any suggestions? :slight_smile: Thanks in advance for any help!

Glance cards do not support entity attributes directly. So either use an entities card (that does support displaying attributes), or create some template sensors that you can use to display your sensor attributes.

1 Like

Alright, but the attributes in question does not show up as entities (the only two available entities derived from the integration are real time consumption and current power price). Do you know how I would go about creating template sensors? Sorry for needing to be spoon fed all this, it’s just that I really don’t know a lot about what I am doing.

Does not matter for the entities card, it has the ability to show attributes. It’s only the glance card that can’t do that. If you are set on using a glance card then read this:

Have a go and if you can’t get it to work post what you came up with here and we’ll help you get it working.

1 Like

Alright, so first of all, thanks for your interest in helping, I really do appreciate it! :slight_smile:

I looked at the template page you sent me, and I think I worked something out that looks like it should work. However, when I added this to my configuration.yaml, I can’t validate my configuration in the server tab (it just loads endlessly after being pressed), and I can’t restart my Home Assistant neither. Any ideas?

sensor:
  -   platform: template
      sensors:
       forbruk_kwt:
       friendly_name: "Forbruk, kWt"
       unit_of_measurement: 'kWt'
       value_template: state_attr('sensor.real_time_consumption', 'accumulatedConsumption')
       icon_template: mdi-lightning-bolt
  -   platform: template
      sensors:
       forbruk_nok:
       friendly_name: "Forbruk, NOK"
       unit_of_measurement: 'NOK'
       value_template: state_attr('sensor.real_time_consumption', 'accumulatedCost')
       icon_template: mdi-cash

EDIT:

Sorry, I’m an idiot. I messed up the indentation, and my configuration now looks like this:

sensor:
  -   platform: template
      sensors:
       forbruk_kwt:
        friendly_name: "Forbruk, kWt"
        unit_of_measurement: 'kWt'
        value_template: state_attr('sensor.real_time_consumption', 'accumulatedConsumption')
        icon_template: mdi-lightning-bolt
  -   platform: template
      sensors:
       forbruk_nok:
        friendly_name: "Forbruk, NOK"
        unit_of_measurement: 'NOK'
        value_template: state_attr('sensor.real_time_consumption', 'accumulatedCost')
        icon_template: mdi-cash

which kinda works, in the regards that I now can check my configuration and restart my HA, which is helpful. It did also create attributes I can show in my entities-card, so I am ever closer to my goal. But, the value presented for the attribute in the card is simply: state_attr(‘sensor.real_time_consumption’, ‘accumulatedConsumption’) and state_attr(‘sensor.real_time_consumption’, ‘accumulatedCost’), which is not quite ideal. I’ll try to fix this now, but I’m always open for ideas since the experienced user probably can see the problem straight away :slight_smile:

value_template: "{{ state_attr('sensor.real_time_consumption', 'accumulatedConsumption') }}"
1 Like

What would I do without you, tom_I? :smiley: Thanks for guiding me towards more knowledge and helping me out, I learned a lot! :slight_smile:

1 Like