-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selects! Numbers! Buttons! ... and more ;) #75
Conversation
Signed-off-by: stefan <[email protected]>
- split out services into own file - use global coordinator passed around in hacs.data - optimize data gathering a bit - update device info to show hardware version in HA - update device info to show detailled firmware version Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Signed-off-by: stefan <[email protected]>
Never mind! Units came back after a few minutes |
To my recollection I didn't change anything there (sensor_list.py) besides some icons. Still wondering why it took some time for them to show up for you. Browser cache? |
…rmeter generation/fixup out of try/except Signed-off-by: stefan <[email protected]>
yepp i think it was browser cache. as this version ran a few days without errors on my side i'll merge this pr |
Inspired by #74 and spurred on by the recent success with services/actions I had a closer look at how to implement selects, sliders and whatnot. This is the result with some added goodies
Main stuff
You'll now get some new inputs that are shown with the device under the "Configuration" section:
excluded on purpose)
There's a lot of code added to make those work. Don't despair, I intend to clean that up if possible.
Warning
When using the sliders, buttons and the selector in the developer tools the help text states that there will be no communication with the device. That's not true here. All changes will be sent to the SonnenBatterie immediately.
Candies
Under the hood
Coordinator
Completely reworked the coordinator. Instead of passing around the credentials and using different client sessions for every sub-section, the integration now uses one connection to
rule themdo it all. The central connection object is now passed around in thehass.data[DOMAIN][config_entry.entry_id]["coordinator"]
global scope of HA.Also, to prevent timeouts when querying the SonnenBatterie, the coordinator now automatically reconnects if the last "login" to the SonnenBatterie API is older than 60 seconds.
Services et al.
For better readability and easier maintenance all sub sections are now split out into different files:
service.py
for the services/actionsbutton.py
for the buttonsnumber.py
for number inputs/sliderssensor.py
well, for the sensors, actually that one isn't newselect.py
for the selctorsentities.py
is the central hub that holds all the helper classes for the files above and also contains the base definitions for selects, numbers and buttonsFinally
Have fun ;)