ssenart / lovelace-gazpar-card

GrDF Gazpar meter lovelace card for Home Assistant
MIT License
7 stars 2 forks source link

Display issues when data is uncommon #10

Closed pafnow closed 1 year ago

pafnow commented 1 year ago

Hi, Thanks for the work it's a really nice addition to Home Assistant (for frenchies ;))

I have two small issues on the monthly history part as you can see below: image

  1. Since I had no consumption at all in August this year, the percentage of trend is shown as "-Infinity%" I understand why but it is not really nice and the table layout is affected. Would it be possible to make it shorter (-∞ or even NA) or simply remove the percentage trend (while keeping the green arrow though) ?

  2. My GRDF contract has started in April 2021, so the data cannot be fechted before for yearly comparison. The table seems to handle this properly. However, on the graph, you can see that the last year grey lines are not affected to the proper months, seems like the missing value are not counted as zero. The grey lines should be shifted to the right with the highest one affected to October. Here is a screenshot of GRDF graph for comparison. image

If I have time to work on this I can try to do a PR on your repo, let me know.

pbox commented 1 year ago

Same thing here, but since I use natural gas only for heating I have 0 consumption during the hot days... First month without consumption is at "-infinity", next 0 months are "NaN", and first actual month of consumption gives a weird number.

Thanks for the work in any case.

image

ssenart commented 1 year ago

Thanks for that, I will fix this shortly.

ssenart commented 1 year ago

I've just released a new version 1.3.1.

Could you confirm your issues are now fixed ? Let me know.

Eventually, send me your screenshots on the new version.

Thanks a lot

pafnow commented 1 year ago

Thanks for your fast update, it looks much better now image

However, I know have an error displayed at the bottom of the card, I can hide it with the proper toggle in the config but I wonder why it was not there before. Please see full error message below.

Failed to query PyGazpar library for frequency=daily. The exception has been raised: Traceback (most recent call last):
  File "/config/custom_components/gazpar/sensor.py", line 147, in update_gazpar_data
    client.update()
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 58, in update
    self.__updateLiveMode()
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 100, in __updateLiveMode
    self.__login(session)
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 151, in __login
    raise LoginError()
pygazpar.client.LoginError
<br>Failed to query PyGazpar library for frequency=weekly. The exception has been raised: Traceback (most recent call last):
  File "/config/custom_components/gazpar/sensor.py", line 147, in update_gazpar_data
    client.update()
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 58, in update
    self.__updateLiveMode()
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 100, in __updateLiveMode
    self.__login(session)
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 151, in __login
    raise LoginError()
pygazpar.client.LoginError
<br>Failed to query PyGazpar library for frequency=monthly. The exception has been raised: Traceback (most recent call last):
  File "/config/custom_components/gazpar/sensor.py", line 147, in update_gazpar_data
    client.update()
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 58, in update
    self.__updateLiveMode()
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 100, in __updateLiveMode
    self.__login(session)
  File "/usr/local/lib/python3.10/site-packages/pygazpar/client.py", line 151, in __login
    raise LoginError()
pygazpar.client.LoginError
ssenart commented 1 year ago

This is an error encountered by the Integration while trying to connect to GRDF site.

What is strange is that you have data displayed despite this error. Perhaps a bug somewhere...

In HA, could you check in "Development tools" menu whether the entity "sensor.gazpar" has effectively an attribute 'errorMessages ' and it contains exactly this message ? Do you have other attributes: 'daily', 'weekly', 'monthly' and 'yearly' filled as well ?

If there is an error message, I do not expect some data.

pbox commented 1 year ago

Awesome, it's perfect now !

image

pafnow commented 1 year ago

This is an error encountered by the Integration while trying to connect to GRDF site.

What is strange is that you have data displayed despite this error. Perhaps a bug somewhere...

In HA, could you check in "Development tools" menu whether the entity "sensor.gazpar" has effectively an attribute 'errorMessages ' and it contains exactly this message ? Do you have other attributes: 'daily', 'weekly', 'monthly' and 'yearly' filled as well ?

If there is an error message, I do not expect some data.

Just for info, it was indeed a problem of the integration, I have fixed it by logging in manually and validating the captcha. Now its back to normal Thanks