Lovelace: Power wheel card

Hi. You must have missed one of the requirements for the power view for the solar sensor: The sensor state value should be a positive number when producing power. I think yours has a negative value when producing power (-2221.17W). Are you familiar with creating template sensors? You could make an extra sensor by e.g.:

sensor:
  solar_power:
    friendly_name: Solar power
    unit_of_measurement: 'Watt'
    value_template: >-
      {{ 0 - states('sensor.emoncms2_solar') | float }}

Then you can use this sensor instead of the emoncms2_solar as input for the card.

Same for your grid_production sensor. The requirements are here if you want to read them again.

I hope you made a typo there. Based on your explanation, it think you meant cc: the rate you otherwise should have payed for importing/consuming the energy from the grid.

But I like your explanation and have put it in the 0.0.13-dev version. Maybe you can check it out on the dev branch and use the new card parameters energy_consumption_rate (‘import’ in your words) and energy_production_rate (‘export’ in your words). Please look into the readme of the dev branch to see further explanation. You can search for the word rate.

haha, yep. my bad.

Just looked at the 0.0.13-dev. Seems to work very well. Lines up almost perfectly with the rates I have on pvoutput.org. The only difference is that I have a daily supply charge that your card doesn’t take into account. Other than that, this is perfect.

Version 0.0.13 has been released

Deprecation warning. Please replace energy_price by energy_consumption_rate in your setup when you use it.

Issue with the card? Please use the bug report of GitHub after reading the wiki to check what you can do before reporting a bug .

New features

  • Split energy rates for consuming from the grid and producing to the grid.
    • Use new card parameters energy_consumption_rate and optional energy_production_rate.
    • DEPRECATED. Current card parameter energy_price is deprecated and its value will be used as value for energy_consumption_rate for a while.
      Please replace energy_price by energy_consumption_rate in your setup.

Improvements

  • Hide values near arrows in more cases.
  • Code improvements.

getting back to trying this card, after having updated hA to 91.2: is there something in the HA versions that blocks the card?
I have the exact same config with the same version card and all identical sensors, and it shows correctly in HA 84.3 while I get the famous red card in 91.2…

still using version 09 dev (had 013 installed but thought that version bump caused the error. apparently not)

----update—

forget my post above, it was this Lovelace: Power wheel card I had forgotten about…

Just a thank you for this, working great with my Smappee which sends usage data over MQTT every second.

1 Like

How do I get mine to work like yours Gadgetuk
Both sides of solar

Here’s my config, I’ve got CT’s on the main incomer to the house, and the feed from the solar panels as shown in the diagram below.

  - cards:
  - type: 'custom:power-wheel-card'
    grid_power_entity: sensor.smapppower_house_power
    production_is_positive: false
    solar_power_entity: sensor.smapppower_solar_power
    title: Power

GridMetering

What sensor do you have for grid_power_production_entity? I see it starts with sensor.sola... and that makes me think you’re using a sensor of your solar panels there. It should be a sensor of your grid.
It depends if you have one sensor for your grid or 2. Pls read the readme where it says ‘requirements for the power view, point 2’. There is some explanation about these two situations. Which situation do you have? i or ii?

EDIT: You can compare your config with the one of @GadgetUK. You are configuring like 2ii and he is like 2i for the power view.

So I could make a template sensor that is what my house is using minus the solar to get the same reading you get for grid_power_entitity:
And then just use my solar sensor for solar_power_entitity: and use your config?
Does your grid sensor see the solar power as well ? Making it go minus ?
I have seperate sensors for every plug in my house and then a sensor for the solar

views:

  • id: example_view
    cards:

    • type: custom:power-wheel-card
      title_power: “Current Watts”
      title_energy: “KWH Today”
      title_money: “Energy costs/savings”
      solar_power_entity: sensor.solar_power
      grid_power_consumption_entity: sensor.grid_power_consumption
      grid_power_production_entity: sensor.solar_power
      solar_energy_entity: sensor.solar_kw_today
      grid_energy_consumption_entity: sensor.grid_energy_consumption
      grid_energy_production_entity: sensor.solar_kw_today

    solar_power:
    friendly_name: ‘Solar power production’
    unit_of_measurement: ‘W’
    value_template: >-
    {{ states.switch.solar.attributes[“current_power_w”] | replace(" W", “”) | float }}
    grid_power_consumption:
    friendly_name: ‘Grid power consumption’
    unit_of_measurement: ‘W’
    value_template: >-
    {{ (states.switch.theatre_ac.attributes[“current_power_w”] | replace(" W", “”) | float +
    (states.switch.ups.attributes[“current_power_w”] | replace(" W", “”) | float) +
    (states.switch.theatre_fridge.attributes[“current_power_w”] | replace(" W", “”) | float) +
    (states(“sensor.laundry_pow_power”) | float)) }}
    grid_power_production:
    friendly_name: ‘Grid power production’
    unit_of_measurement: ‘W’
    value_template: >-
    {{ states.switch.solar.attributes[“current_power_w”] | replace(" W", “”) | float }}
    grid_energy_consumption:
    friendly_name: ‘Grid energy consumption’
    unit_of_measurement: ‘kW’
    value_template: >-
    {{ (states.switch.theatre_ac.attributes[“today_energy_kwh”] | replace(" kW", “”) | float +
    (states.switch.ups.attributes[“today_energy_kwh”] | replace(" kW", “”) | float) +
    (states.switch.theatre_fridge.attributes[“today_energy_kwh”] | replace(" kW", “”) | float) +
    (states(“sensor.laundry_pow_kwh_today”) | float)) }}

Let’s do this step by step. About the requirements for the power view, please see my question a few messages up:

Could you answer this?

There’s also a list in the same readme of all the features of the card. I got the feeling that you’re expecting the card to have other features than available. E.g. this feature of the card:

  • Calculates the current power that your home is consuming: home power. Input for the calculation is the power that your solar panels produce and the power consumed from and produced to the grid.

So the card calculates the home power. You seem to have that value available and want to use it as input, but it’s output of the card.

If you want to use the card, you should have a sensor somewhere near the point the power line is entering your house. So people use a Smart Meter for that. (Common in the Netherlands). Other people put sensors around power cables. That could also work as grid sensor.

Another remark: please take notice of the big animated gif in the header of every topic in this forum. It will help you formatting your code properly when you copy something into a message on this forum.

I’m using 2i

I don’t have a clamp on my grid but could I create a sensor that is my house power consumption munis solar which in term would be the same reading you would get for

Sorry I’m learning :slight_smile:

would be nice to have the option to hide or show the values near arrows as i liked them
might go back to 0.0.12

If you really are able to sum all used power in your house, yes, you should be able to create this grid sensor yourself. You’ll end up in situation 2ii then: one grid sensor (not two) that has positive values when you are consuming from the grid, and negative values when you are producing to the grid. This means that you have a polarity that is not the default polarity (because that’s positive=producing), but you can correct that by changing your template sensors or by using the producing_is_positive parameter and set it to false.

Try

grid_power_entity: <your grid sensor>
producing_is_positive: false

and skip the grid_power_consuming_entity and grid_power_producing_entity because they are only needed when having 2 separated grid sensors which you don’t have (=2i).

The values near the arrows are only hidden when they have redundant values. I.e. when the arrow value is the same as e.g. the grid value or the home value. It’s not working perfectly yet, as you can see in the image that is uploaded a couple of messages earlier. The grey numbers should be hidden there, because they are the same as below the icons. Possibly a rounding issue there.

For the other view, the energy view, you’ll probably end up in situation 4ii of the readme.

NP. :slight_smile:

after a while not having updated my lovelace cards, Ive hit update all yesterday… HA still on 84.3.

Had already updated Powerwheel card before that, and it was working fine. Ive now added the rate variables and my config is:

#  - !include /config/lovelace/includes/power_wheel_card.yaml
# https://github.com/gurbyz/custom-cards-lovelace/tree/master/power-wheel-card
type: 'custom:power-wheel-card'
title_power: Actueel verbruik
title_energy: Totaal verbruik vandaag
title_money: Totaal kosten vandaag
solar_power_entity: sensor.zp_actuele_opbrengst
grid_power_entity: sensor.netto_verbruik
grid_power_consumption_entity: sensor.grid_power_consumption
grid_power_production_entity: sensor.grid_power_production
solar_energy_entity: sensor.solar_energy_entity
grid_energy_entity: sensor.grid_energy_total
grid_energy_consumption_entity: sensor.calculated_totaal_dag_afname
grid_energy_production_entity: sensor.calculated_totaal_dag_levering
color_icons: true
consuming_color: 'red'
producing_color: '#fdd835' #arrow_yellow
power_decimals: 2
energy_decimals: 2
money_decimals: 0
energy_consumption_rate: 0.20
energy_production_rate: 0.20
initial_view: 'energy'
auto_toggle_view_period: 10
initial_auto_toggle_view: true

with the new card, nothing is displayed, no error either. trying the trick from https://github.com/thomasloven/lovelace-card-tools/pull/11/files show this:

38

are these latest cards no longer compatible with previous versions of HA? for reference, most of my other cards are visible, except for the markdown and custom markdown card as far as I see now.

Hi Marius,

This is to be used for cards to be able to work in HA 0.88.0 and newer, because ‘hui-error-entity-row’ was removed in HA 0.88.0. And your HA is still on 0.84.3, so this ‘trick’ shouldn’t be needed.

But… since the ‘trick’ is already implement in power-wheel-card a few versions ago (0.0.10), I think your update didn’t succeed and you’re still looking at an old card and not at the latest version. Can you see the version number in the code? Should be 0.0.13.

Also please take a look at the custom-updater itself, because there are breaking changes in their component also since you last pressed the ‘update all’ button. (Custom-updater won’t update itself. The owner switched that off for a while.)

Also please take a look in the changelog of power-wheel-card and especially the lines on

Render styles according to version 2.0.0-rc.5 of lit-element in HA 0.87.0.

This could mean (because of you still being on HA 0.84.x) that you can’t upgrade to the latest power-wheel-card and should remain on 0.0.9 until you start upgrading HA again.

I hope I gave you enough leads and info to figure it out.

yes, update went fine.

yes thats a real misery lately… still it managed to update all cards to their latest versions. (dont use the new file layout though and all my resources are still in the official Lovelace location.

]that might be it then.
Will reinstate 0.9 again and wait for HA to be in a version state that wont cause issues on other components I need (Hue as a main point of interest.)

thanks for your tips!