custom-components / sensor.avanza_stock

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

new functionality: option to add multiple portfolio holders #148

Closed eddysteurs closed 1 year ago

eddysteurs commented 1 year ago

would it be possible to add a portfolio holder into the entities, I have 2 holders and in both I have some same stocks (one portfolio is self managed, the other by a external portfolio management company). In the current setup I can not have the same stock (e.g. Microsoft) in both portfolios because it is based only on avanza id number

oli737 commented 1 year ago

I have requested the same in #136. Same topic.

claha commented 1 year ago

As I've written in the other thread, I will not change the unique id since it will be a breaking change for most people but you can always modify the function yourself to make it work

Example

    @property
    def unique_id(self):
        """Return the unique id."""
        return f"{self._stock}_{self._shares}_stock"
oli737 commented 1 year ago

I did copy the code lines to my the sensor.py and replaced the existiting 4 lines (just one line has changed) I rebooted home assistant. It does still not work as before. :(

claha commented 1 year ago

If you have the same stock and same amount of shares the example I gave you wont work, you would need something more then to make it unique. You could also just remove the function competely I guess