custom-components / sensor.avanza_stock

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

Trigger instrument updates through service call #113

Closed ronnydahl closed 3 years ago

ronnydahl commented 3 years ago

Is it possible to trigger instrument updates through service call? It's tedious to restart the HASS instance when doing changes in config.

claha commented 3 years ago

I have the following automation.

# Stocks: Update States After Close
- alias: 'Stocks: Update States After Close'
  initial_state: true

  trigger:
    - platform: time
      at: '17:50:00'

  condition:
    condition: state
    entity_id: binary_sensor.workday
    state: 'on'

  action:
    service: homeassistant.update_entity
    entity_id:
      - sensor.stock_abb_ltd
      - sensor.stock_angler_gaming
      - sensor.stock_astrazeneca
      - sensor.stock_betsson_b
      - sensor.stock_bure_equity
      - sensor.stock_bitcoin_zero
      - sensor.stock_cell_impact_b
      - sensor.stock_creades_a

The action part could put in a script instead or called for the service tab i developer tools.

The listed stocks are not a recommendation, always do your own analysis before buying.