reptilex / tesla-style-solar-power-card

Home assistant power card mimicking the one tesla provides for the powerwall app.
211 stars 59 forks source link

Incorrect Values Shown #88

Closed BlueMoon23 closed 2 years ago

BlueMoon23 commented 2 years ago

Hi, First of all thanks for writing what looks to be a great card. I tried setting up for my Powerwall and Solar Panels yesterday, and while the figures were initially correct, they have since changed significantly. I am relatively new to HA, so perhaps if I explain what I have done it may help. First, I added the template sensors to my Configuration.yaml file, this appeared to work and I identified the entities. Second, I included your text to configure the card. Basically, for these two steps I copied the last two boxes from your GitHub instructions. there was one error in relation to the entity name, but I resolved that. When I look at my card through, it reports the figures as significantly above what they actually are. I have a screenshot here: image

When I click on the Solar Grid from the your app, I get this: image

As you can see the two figures for the Solar Output are significantly different. Any idea what I am doing wrong, or is there a fault?

reptilex commented 2 years ago

Can it be that you are using generator_to_battery_entity instead of battery_to_house_entity?

On Sun, Aug 22, 2021 at 1:43 PM BlueMoon23 @.***> wrote:

Hi, First of all thanks for writing what looks to be a great card. I tried setting up for my Powerwall and Solar Panels yesterday, and while the figures were initially correct, they have since changed significantly. I am relatively new to HA, so perhaps if I explain what I have done it may help. First, I added the template sensors to my Configuration.yaml file, this appeared to work and I identified the entities. Second, I included your text to configure the card. Basically, for these two steps I copied the last two boxes from your GitHub instructions. there was one error in relation to the entity name, but I resolved that. When I look at my card through, it reports the figures as significantly above what they actually are. I have a screenshot here: [image: image] https://user-images.githubusercontent.com/21972216/130353706-4e9b8405-0a22-4808-b23e-db5a91c3920a.png

When I click on the Solar Grid from the your app, I get this: [image: image] https://user-images.githubusercontent.com/21972216/130353736-bbab29eb-963b-49a2-82d0-6493f5b44c49.png

As you can see the two figures for the Solar Output are significantly different. Any idea what I am doing wrong, or is there a fault?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/reptilex/tesla-style-solar-power-card/issues/88, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5PHRMS4SGJ5H5PBWSQIXLT6DPGBANCNFSM5CS3X7AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

BlueMoon23 commented 2 years ago

Hi,

I took look at the configuration.yaml file and I have this:

template:

The Tesla Card is set up as follows:

type: custom:tesla-style-solar-power-card house_entity: sensor.powerwall_load_now grid_entity: sensor.tesla_card_grid_consumption battery_entity: sensor.tesla_card_battery_consumption generation_entity: sensor.powerwall_solar_now generation_to_grid_entity: sensor.tesla_card_grid_feed_in generation_to_house_entity: sensor.tesla_card_solar_consumption generation_to_battery_entity: sensor.tesla_card_battery_charging_inside battery_to_house_entity: sensor.tesla_card_battery_consumption grid_to_house_entity: sensor.tesla_card_grid_consumption battery_extra_entity: sensor.powerwall_charge

This is set up as per the instructions, it looks to be using both of these entities.

reptilex commented 2 years ago

generation_to_battery_entity: sensor.tesla_card_battery_charging_inside is wrong it should be generation_to_battery_entity: sensor.tesla_card_battery_charging

On Sun, Aug 22, 2021 at 7:11 PM BlueMoon23 @.***> wrote:

Hi,

I took look at the configuration.yaml file and I have this:

template:

  • sensor:

    name: "Tesla Card Grid Consumption" unique_id: 'tesla_card_grid_consumption' state: "{{ states('sensor.powerwall_site_now') | float | max(0) | round(1) }}" device_class: power unit_of_measurement: kW

    name: "Tesla Card Grid Feed In" unique_id: 'tesla_card_grid_feed_in' state: "{{ states('sensor.powerwall_site_now') | float | min(0) | abs | round(1) }}" device_class: power unit_of_measurement: kW

    name: "Tesla Card Solar Consumption" unique_id: 'tesla_card_solar_consumption' state: "{{ ((states('sensor.powerwall_solar_now') | float) - (states('sensor.tesla_card_grid_feed_in') | float ) - (states('sensor.tesla_card_battery_charging') | float) ) | round(1) }}" device_class: power unit_of_measurement: kW

    name: "Tesla Card Battery Consumption" unique_id: 'tesla_card_battery_consumption' state: "{{ states('sensor.powerwall_battery_now') | float | max(0) | round(1) }}" device_class: power unit_of_measurement: kW

    name: "Tesla Card Battery Charging Inside" unique_id: 'tesla_card_battery_charging' state: "{{ states('sensor.powerwall_battery_now') | float | min(0) | abs | round(1) }}" device_class: power unit_of_measurement: kW

The Tesla Car is set up as follows:

type: custom:tesla-style-solar-power-card house_entity: sensor.powerwall_load_now grid_entity: sensor.tesla_card_grid_consumption battery_entity: sensor.tesla_card_battery_consumption generation_entity: sensor.powerwall_solar_now generation_to_grid_entity: sensor.tesla_card_grid_feed_in generation_to_house_entity: sensor.tesla_card_solar_consumption generation_to_battery_entity: sensor.tesla_card_battery_charging_inside battery_to_house_entity: sensor.tesla_card_battery_consumption grid_to_house_entity: sensor.tesla_card_grid_consumption battery_extra_entity: sensor.powerwall_charge

This is set up as per the instructions, it looks to be using both of these entities.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/reptilex/tesla-style-solar-power-card/issues/88#issuecomment-903300532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5PHRPEO3LNQGDAJP43SYLT6EVS5ANCNFSM5CS3X7AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

BlueMoon23 commented 2 years ago

This was the error I referred to in my first post. When I change it to what you say, I get the following error: Configured 'sensor.tesla_card_battery_charging' entity was not found.

I took a look at the entities generated and I got this: image hence I made the tweak added "_inside". For some reason the template entry is coming up wrong. In configuration.yaml it is "sensor.tesla_card_battery_charging", but in HA it is "sensor.tesla_card_battery_charging_inside"

reptilex commented 2 years ago

Have you tried changing the name of the batter charging instance to be called just "Tesla Card Barrery Charging" because I'm sure your problem lies with that sensor

On Sun, Aug 22, 2021 at 7:55 PM BlueMoon23 @.***> wrote:

This was the error I referred to in my first post. When I change it to what you say, I get the following error: Configured 'sensor.tesla_card_battery_charging' entity was not found.

I took a look at the entities generated and I got this: [image: image] https://user-images.githubusercontent.com/21972216/130365104-3b8e5dd3-9164-496b-be7d-8269f3f83154.png hence I made the tweak added "_inside". For some reason the template entry is coming up wrong. In configuration.yaml it is "sensor.tesla_card_battery_charging", but in HA it is "sensor.tesla_card_battery_charging_inside"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/reptilex/tesla-style-solar-power-card/issues/88#issuecomment-903306206, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5PHRNV2GSQDP5E7DMFIXTT6E22NANCNFSM5CS3X7AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

BlueMoon23 commented 2 years ago

Yes, I have tried that, but as I said, I get a configuration error. ("Configured 'sensor.tesla_card_battery_charging' entity was not found."

For some reason, even though the configuration.yaml file is correct, when HA reads it, it renames the Entity ID by adding "_inside" I am not sure why. This particular sensor is the only one of the five from your information page where the name and Unique_Id of the sensors are different (taking into account the underscores and the spaces), HA looks to read the name as opposed to the Unique_ID.

What puzzles me, is when I click on the Tesla Car Solar Generation Icon, I get the correct figure in the info box, and the correct entity. It is just the display on the card that is incorrect.

skippy-oz commented 2 years ago

I have the same issue I have tried the above with the same results the Tesla powerwall just got installed last week

skippy-oz commented 2 years ago

I have been some testing Found that once the battery is fully charged. The Values are correct.

BlueMoon23 commented 2 years ago

I looked into this a little more and observed the following: If "Powerwall Battery Now" is negative, i.e. Solar is charging the Battery it incorrectly adds to "Powerwall Solar Now" making the Solar Power Icon incorrect (it appears too much solar is being generated). If "Powerwall Battery Now" is positive, i.e. the house is using the battery, the Solar Power Icon is correct. @skippy-oz are you seeing this as well?

skippy-oz commented 2 years ago

I created a new Tab in Lovelace with The Tesla card and all the sensors so that you can see what is going on. I only have a 5.2kw solar system. @BlueMoon23 you can see that the Battery Now is a negative while it's charging

Screen Shot Battery Charging am
BlueMoon23 commented 2 years ago

@skippy-oz You look to have the same issue as me, your "Powerwall Battery Now" is -3.43, add the absolute value (3.43) to your "Powerwall Solar Now" (3.799) and you get approx 7.2. At least the error seems consistent.

Stormalong commented 2 years ago

Change this line:

    state: "{{ ((states('sensor.powerwall_solar_now') | float) - (states('sensor.tesla_card_grid_feed_in') | float ) - (states('sensor.tesla_card_battery_charging') | float) ) | round(1) }}"

to this

    state: "{{ ((states('sensor.powerwall_solar_now') | float) - (states('sensor.tesla_card_grid_feed_in') | float ) - (states('sensor.tesla_card_battery_charging_inside') | float) ) | round(1) }}"

Apparently the "unique_id" for that sensor is not being honored and HA is naming it "tesla_card_battery_charging_inside" and not "tesla_card_battery_charging" as specified.

BlueMoon23 commented 2 years ago

Thanks, that looks to work for me. Sorry about the delay, I was waiting for some sun!

skippy-oz commented 2 years ago

Thanks, Been running it for a few days and looks like that has fixed the issue that I was having.