Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card Cramming leads to distortion #30

Closed
Siggy101 opened this issue Oct 23, 2020 · 17 comments
Closed

Card Cramming leads to distortion #30

Siggy101 opened this issue Oct 23, 2020 · 17 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Siggy101
Copy link

Hi @JonahKr . First off, thank you for making an awesome card. I love it!

I recently installed v1.6 and tried out the adaptive W/kW detection.
It seems that it is not working right with my Smart Meter:
image
This should be showing either 249W or 0.249kW.
Any chance you can have a look?

In addition, the arrows no longer line up with the item they are displaying. They seem too low now.

Last point: The new slide option for the arrows is super slick. I love it! However, when I enable it and look at the Android app, they are still flashing, not sliding.

@Siggy101
Copy link
Author

Siggy101 commented Oct 23, 2020

In case you need it, here is the card config:

type: 'custom:power-distribution-card'
title: Power Distribution
animation: slide
entities:
  - solar:
      entity: sensor.envoy_current_energy_production
      name: Solar
      unit_of_display: adaptive
  - grid:
      entity: sensor.smartmeter
      name: Grid
      unit_of_display: adaptive
  - consumer:
      entity: sensor.lounge_power
      name: Lounge radiator
      icon: 'mdi:radiator'
      invert_value: true
      unit_of_display: adaptive
  - consumer:
      entity: sensor.demi_s_room_power
      name: Demi's radiator
      icon: 'mdi:radiator'
      invert_value: true

@JonahKr
Copy link
Owner

JonahKr commented Oct 23, 2020

OK first of all thanks alot for reporting the issues 👍
If this is the view you are getting there is something terribly wrong...
Actually when i open my phone it looks like this?

I will try to replicate it.. maybe it has something to do with the width of the parent card but not sure. The arrow issue is quite certainly connected to that aswell.

Regarding the Adaptive display: I don't know what is going on here... Especially when it seems to work with your solar ?
Furthermore when displaying kW it shouldn't display more then 2 decimals...

Can you try Hard-Reloading your browser? (Chrome : Shift+F5, Firefox: CTL + Shift+ R, Safari: Command (⌘) + Option (⌥) + R)

@Siggy101
Copy link
Author

Hi and thanks for the super swift reply.
Maybe I wasn't clear but that screenshot was from my laptop, not the app. I think it was because the column width was being reduced due to there being 3 columns in my view. I created a new view and moved the card to there and it now looks far better:
image

I am not a Lovelace expert. Can you suggest a way to fix/set the width of the cards? I would prefer for them to flow vertically instead of creating a new column when I add a card.

Even more strange is that now I have made the new view, when i look on my app, the arrows are sliding perfectly. How weird!
image

I think that explains (if not resolves) the view and layout issues but I don't know how to resolve the adaptive W/kW one. Perhaps that's a real bug...?

@JonahKr
Copy link
Owner

JonahKr commented Oct 23, 2020

Ok. I was able to replicate the "cramming issue" with a to small view. The Problem never occured to me before. I will look into it and realease a hotfix if i'm able to solve it .

For the adaptive display, i wasn't able to replicate it yet.
Is this Sensor in kW?

Thanks for your help 😅

@JonahKr JonahKr changed the title adaptive w/kW + arrow alignment + app arrow slide Adaptive w/kW scaling issue + Card Cramming leads to distortion Oct 23, 2020
@JonahKr JonahKr added the bug Something isn't working label Oct 23, 2020
@JonahKr JonahKr self-assigned this Oct 23, 2020
@Siggy101
Copy link
Author

Great stuff.
I will leave it on another view for now and will happily test the fix as and when you find one.

The grid sensor is a SmartMe smart meter.
It looks like it is in kW with 3 decimal places:
image

I will go try setting the card to display it in kW and see how it goes.
Incidentally, I like the 3 decimal places...

@JonahKr
Copy link
Owner

JonahKr commented Oct 23, 2020

@Siggy101 Ok i see the Issue here... your smart meter is measuring in kwh which is a different unit then kW... Thats why it isn't detected...

Actually kW and kW-h mean different things as the latter is considering the time aswell, so the calculations would be wrong aswell...

I will need to think about if i should add support for that. Or just recommend unit_of_measurement: kW for now...
Maybe you have a different Opinion?

@Siggy101
Copy link
Author

Sorry, that is a red herring.
The unit kWh is incorrect in that screenshot.
I am very aware of the difference between the units of power (kW) and capacity (kWh) so please ignore that direction. I will correct the Smartmeter display as it is indeed showing the current power flowing in or out of the house and is kW, not kWh.

@Siggy101
Copy link
Author

OK, it looks like the mix of power and counters was confusing it.
I have removed the counter (just a daily total of how much energy has been imported vs exported) and it has now sorted itself out:
image

@Siggy101
Copy link
Author

Siggy101 commented Oct 24, 2020

...and even better news! The confusing readings were indeed messing with the W/kW interpretation and it now looks perfect in the new card:
image
I will have to wait until my panels are producing over 1kW to confirm that it switches to kW correctly.

@Siggy101
Copy link
Author

Siggy101 commented Oct 24, 2020

OK, the sun came out and the panels are making plenty of juice. You can ignore the fact that the panels are under-reporting their output. The API for them only seems to update every 15 mins.

I am happy to report that the card correctly changed to show kW:
image

@JonahKr
Copy link
Owner

JonahKr commented Oct 24, 2020

👌 Nice so this one is resolved.
So the counter broke the display?

@Siggy101
Copy link
Author

Yep, it looks like having the 2 outputs from the smart meter, one in kW and one in kWh was enough to stop the card adaptively switching between the 2. I can see how that could happen.
Although it was nice to see the daily total production, I can live without the counter if it means this card displays correctly. If you were able to debug it and make it adaptively change between W and kW even when there are multiple counter outputs, that would be super duper. I'm happy to help with logs etc. if needed.

@JonahKr
Copy link
Owner

JonahKr commented Oct 24, 2020

So i think i found fixes for 2 of your issues. maybe you can checkout the 1.6.1 prerelease and tell me if it works?
https://github.com/JonahKr/power-distribution-card/releases/tag/v1.6.1

There is a new attribute Setting which allows you to fetch from a attribute instead of the entity directly...

and kWh is now supported

@Siggy101
Copy link
Author

Thanks. Will install and test.
I did try something yesterday that seemed to help. I changed the order if the attributes in my config so that the power (kW) was before/above the counter (kWh). That seemed to help.
I will change the order back and test 1.6.1

@Siggy101
Copy link
Author

OK, it looks like your idea to allow the user to specify the attribute has nailed it. I can put the attributes in any order in my configuration file and it is displaying W/kW correctly. I can also add the counter and it will show it in kWh too.
It is now working perfectly!! Thank you.

@JonahKr JonahKr added this to To do in v2.0 via automation Oct 25, 2020
@JonahKr JonahKr moved this from To do to In progress in v2.0 Oct 26, 2020
@JonahKr JonahKr added this to the v2.0 milestone Dec 15, 2020
@JonahKr JonahKr changed the title Adaptive w/kW scaling issue + Card Cramming leads to distortion Card Cramming leads to distortion Dec 24, 2020
@JonahKr JonahKr removed this from In progress in v2.0 Dec 24, 2020
@JonahKr JonahKr modified the milestones: v2.0, v2.1 Dec 24, 2020
@JonahKr
Copy link
Owner

JonahKr commented Jan 8, 2021

ok then this should be solved now. I had to switch from CSS media queries to Resize Observers 😅 Let me know if it worked for you @Siggy101

@JonahKr JonahKr closed this as completed Jan 8, 2021
@Siggy101
Copy link
Author

Siggy101 commented Jan 8, 2021

Sure thing. I'll update and test over the weekend.
Thanks for your efforts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants