iprak / yahoofinance

Home Assistant component which allows you to get stock updates from Yahoo finance.
MIT License
81 stars 11 forks source link

Past value. #108

Closed spacecabbie closed 8 months ago

spacecabbie commented 10 months ago

Hi i am making an automation that basicaly calls out current price every 15 minutes on my home speakers.

Now I want to track the price like this: service: tts.speak target: entity_id: all data: message: Current gold price is: {{states.sensor.yahoofinance_xaut_usd.state}} Last price was: {{states.sensor.yahoofinance_xaut_usd.?????}} media_player_entity_id: media_player.nest_speakers

Any advice what i can do here ? I looked trough the list of states but none match price last x minutes orso

iprak commented 10 months ago

Sorry there is no such concept built into an entity. The previous data at market closing time is captured in RegularMarketPreviousClose. You can save off the current value into a custom attribute after the announcement in the same automation.

Here are some articles which I found regarding updating custom attribute: