custom-components / sensor.avanza_stock

Custom component to get stock data from Avanza for Home Assistant
MIT License
46 stars 10 forks source link

Nan error after upgrade from v1.2.0 to v1.3.0 #161

Closed rinkassie closed 10 months ago

rinkassie commented 11 months ago

asml-holding-nv with stock id 732279 gives NAN error after update to V1.3.0. Reverting to V1.2.0 gives the correct values again.

claha commented 11 months ago

Is the state NAN or some attributes? Are there any errors in the homeassistant log?

manofpants commented 10 months ago

I am getting the same thing:

# Avanza Stock HACS integration
- platform: avanza_stock
  stock:
    - id: 194698
      name: GME
    - id: 450548
      name: AMC
    - id: 3484
      name: HPQ
  monitored_conditions:
    - totalVolumeTraded
    - totalValueTraded

image

and only thing in the logs is that the integration is taking a while to load:

Logger: homeassistant.components.sensor
Source: runner.py:186
Integration: Sensor (documentation, issues)
First occurred: 1:16:28 PM (2 occurrences)
Last logged: 1:16:28 PM

Setup of sensor platform avanza_stock is taking over 10 seconds.
claha commented 10 months ago

I copied your config and it works fins for me, I am on version 1.4.0 though but that shouldn't matter for the state. Could you please confirm that the state is also NaN in "Developer tools -> States", so that it is not some big with that card? What card is it?

manofpants commented 10 months ago

@claha good call on the checking the states. Apparently at some point duplicate sensors were created and I found that the entity is now sensor.gme_2 and such. Why that happened I don't know :)

If OP and I had the same-looking problem around the same time, maybe something in the update cause HA to ignore the old entities?

rinkassie commented 10 months ago

FYI,

I discovered after the upgrade that a new sensor was made (in my case sensor.asml_2) and the original was greyed out. I found it by looking in the 'States' section of the 'Developer Tools'.

The new sensor gave no errors and had valid results. But as it was unexpected I decided to look a bit further and searched for the new sensor in the core.entity_registry.

I found multiple entries of the original one (sensor.asml_1 was also present), deleted them all and also temporarily disabled the lovelace references to the original one (sensor.asml) and restarted HA.

Afterwards the original sensor was working again. Today I did the update to 1.4.0. and it gave me no issues.

I don't kniw if something similar has happened in your case, but it might be useful to check the Developer Tools States section..

Hope to help...

⁣Get TypeApp for Android ​

On 11 Sep 2023, 19:51, at 19:51, manofpants @.***> wrote:

I am getting the same thing:

# Avanza Stock HACS integration
- platform: avanza_stock
 stock:
   - id: 194698
     name: GME
   - id: 450548
     name: AMC
   - id: 3484
     name: HPQ
 monitored_conditions:
   - totalVolumeTraded
   - totalValueTraded

image

and only thing in the logs is that the integration is taking a while to load:

Logger: homeassistant.components.sensor
Source: runner.py:186
Integration: Sensor (documentation, issues)
First occurred: 1:16:28 PM (2 occurrences)
Last logged: 1:16:28 PM

Setup of sensor platform avanza_stock is taking over 10 seconds.

-- Reply to this email directly or view it on GitHub: https://github.com/custom-components/sensor.avanza_stock/issues/161#issuecomment-1714332327 You are receiving this because you authored the thread.

Message ID: @.***>

manofpants commented 10 months ago

I did the same, but instead just deleted the grey ones, removed the integration, rebooted, removed the "new" ones (with _2), commented out the sensor declarations in yaml, re-installed the integration, rebooted, un-commented, rebooted and everything's back to normal now lol

:)

claha commented 10 months ago

Happy to hear that things seems to work again (after some reboots and editing :)). I think it has to do with that I needed to change how the unique id was generated because of #136