custom-components / sensor.avanza_stock

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

Sensor not updating #125

Closed Georgeleeh closed 2 years ago

Georgeleeh commented 2 years ago

Sorry if this is just a me problem but my stock sensors only seem to be updating when I reboot and I can't see a way to set the update frequency?

I've been rebooting a fair bit as I've been figuring out my config and every time I do, I get the latest price. But when the system is left it doesn't seem to be updating at all? At least, not anywhere near as frequently as I'd like. Is there a way to set the update frequency?

Here's my config:

sensor:
  - platform: avanza_stock
    stock:
      - id: 194698
        name: GME GBP 1
        shares: XX
        purchase_price: XXX
        conversion_currency: 455493
        invert_conversion_currency: true
      - id: 450548
        name: AMC GBP
        shares: XX
        purchase_price: XXX
        conversion_currency: 455493
        invert_conversion_currency: true
      - id: 194698
        name: GME GBP 2
        shares: XX
        purchase_price: XXX
        conversion_currency: 455493
        invert_conversion_currency: true
    monitored_conditions:
      - lastPrice
      - lastPriceUpdated
      - change
      - changePercent
      - name

Thanks!

claha commented 2 years ago

Default update interval is 1h, you can easily change it to 60s or whatever you prefer.

- platform: avanza_stock
  scan_interval: 60
  stock:

Let me know if that helps :)

Georgeleeh commented 2 years ago

That's done it, thanks!

Sorry if this is written somewhere, I couldn't see it in the documentation.

claha commented 2 years ago

I tyink you can do it for every type of sensor, so it is somewhere in the HA documentation but not for this component.

guus461 commented 2 years ago

Exactly what I was looking for ;-) Thanks both

runshotgun commented 2 years ago

Should be documented, very useful! Thank you for this very useful tool!