Select number of phases setting - #101
Conversation
|
I'll have to double check, but I'm fairly certain it is not guaranteed that L1 will be the reporting phase on a 1-phase grid. |
|
I see. Then lets check to see what phases have no value, and hide them. Then show all three when setting is switched back. Will work on rare 2-phase installations as well. |
|
@philipostli So we think this needs to be 3 settings to hide/show individual phases. Not sure it's worth the boilerplate for this. Since I myself do not have a 1-phase installation, how big of a nuisance is this in the app? |
|
Thanks for replying. I do not see the need for time tracking the value. My capability dashboard says '-' in those two other phases, and the old value is there on app-restart. If we switch on the setting, we instantly know what phase to show and what two others to hide. If this do not work somehow, one can always switch it of again to reveal all three phases. But for the purpose of POC I also do exactly this same thing in the Zaptec app that I develop together with Patrick. I can not see how it will introduce bugs. As long as one always check if a capability exists: I now have 8 capabilities and have no need to scroll. But adding only one more will make it a bit annoying. I find it annoying just now with two unused capabilities. |
|
@philipostli
And then, in if (this.getSetting('disable_capabilities_phase_l1')) {
if (this.hasCapability('measure_current.L1')) {
await this.removeCapability('measure_current.L1');
}
} else {
if (!this.hasCapability('measure_current.L1')) {
await this.addCapability('measure_current.L1');
}
}
// etc...If we were to do Using the plural Thoughts? |
|
I understand your concerns. I tested alot to learn about the implications of removing capabilities. I have found four points of interests:
Now I guess people have fixed number of phases. And have not used flowcards for the phases that have no value in them? If not, I guess the risk of breaking flows is minimal. But as an alternative one could just hide the capability in the dashboard by changing the ui-component, dynamically: This would keep all the flowcards, tokens etc, and keep the ordering of the capabilities dashboard. Migrating the capability on init would be unneccesary. Because the device keeps its capabilities upon restarts. And new devices have them all enabled by default. We would only need the code in onSettings(). |
…ce single phase mode checkbox with individual checkboxes for each phase (L1, L2, L3) in the configuration. Update device logic to handle visibility changes accordingly.
|
Lets do it simple and just hide the ui-component. Not fiddling with the capability more than necessary. |
Why
On a 1-phase power-grid we do not need the two empty phases measuring no current, so I wanted a setting to hide them from capabilities view.
What
I added a checkbox setting to the Pulse and Watty drivers
Default value is true (most people have 3-phases)
Upon change it removes/adds the capabilities measure_current.L2 and measure_current.L3 on the device
Test
Tested on Pulse. ✔️
Watty not tested, but should work similarly.