Closed Tommatheussen closed 2 years ago
Thank you for getting involved. It's really great to have more people contributing to the project. I'm happy to include your pull request, if it fixes something for you, but I don't understand why it would help.
The comparitor sensor is just the same as the input sensor (import or export). I included it so I could later add a feature to compare the imported electricity before and after the simulation for example. If your input sensor hasn't got any data then the comparitor sensor shouldn't either. Also there isn't a comparitor for the main battery level itself, only for the simulated import and export readings.
Anyway as I've said if you've tested it and it helps then I can accept the pull request, but I'm afraid it might not work like you think.
Sorry, I think I understand what you're doing now. Ignore my previous comment. Thank you for the contribution!
I've reorganised the code a bit in the latest update. I hope I have maintained the functionality you added, but if I've broken it again for you do let me know. Thanks for your contributions.
Thanks for the integration! Just set it up for myself, but I had to make a little tweak to make it work with my source data. When I restarted Home Assistant, my template sensor (which is used to sum both tarif values of my smart meter) might not be available straight away. This means, the state is 'unknown', which causes the battery_sim integration to fail starting.
This change actually makes sure we check the unknown/unavailable state of the comparitor sensor, and only after we tried to restore the state.