If you are going to keep the existing unifi:client:home:matthewsPhone:uptime Channel as a Number (and maybe add UoM support and switch it to: Number:Time and Number:Dimensionless for the rssi)
I would say:
unifi:client:home:matthewsPhone:uptimeDuration as a String Type
butā¦ why keep the Number one? better change the existing Channel type to String and keep the same UID: unifi:client:home:matthewsPhone:uptime
edit: I donāt know if using UoM and keeping using Number:Time will be useful to format in the Item label the seconds into other formatsā¦ I am not using UoM so much to say if this is possible.
@vzorglub : Do you know if I have a Number:Time Channel Type with values in seconds and an Item linked to it: Can I use formatting in the label to display hh:mm:ss ?
The state of the Item would be: 23454 (seconds) and I would like to display this in another wayā¦ is this possible with UoM? (or the Channel needs to be a DateTime type?)
Meaning the conversions wouldnāt be dependent on one anotherā¦ āonly show 1 second because itās the remainder of 1 = 3661 - 3600 (1 hour) - 60 (1 minute)ā
I think itās a lot easier to trigger a rule based on āsecondsā changing to 301 or something like that vs. a string that says ā5m 1sā like itās shown in the controller UI. Your format string is simply a visual representation of the raw value seconds.
I also would argue in favor of keeping the uptime channel as a raw number. Channels can be created for the other representations.
IMHO, if the 2.4 release is just a couple weeks away, wouldnāt it make sense to keep changes to a minimum and focus on getting the binding into the build.
UoM was fairly easy to implement but the conversions are wrong:
8 h = 60 x 60 x 8 = 28800 28013 < 28800
Yet the internal UoM conversion is showing 8 hoursā¦
I think itās because of the decimal conversion format [%d h]. I would think it would round downā¦ with time conversions, but it seems to be doing bankers rounding.
Using [%.1f h] gives the partial valuesā¦
Anyways, Iāll look at rebasing asap and re-igniting the PR.
So I made a lot of progress on the PR but some critical parts of the binding changed so PLEASE PLEASE PLEASE update and test the latest build out ASAP so we can try and get this merged!
2 small warnings because OH2 still tries to load the old (2.3.x) version of the binding
2018-12-06 21:18:12.692 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.unifi-2.4.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.unifi [254]
Another singleton bundle selected: osgi.identity; type="osgi.bundle"; version:Version="2.3.0.201812040910"; osgi.identity="org.openhab.binding.unifi"; singleton:="true"
at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]
2018-12-06 21:18:12.703 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.unifi-2.4.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.unifi [254]
Another singleton bundle selected: osgi.identity; type="osgi.bundle"; version:Version="2.3.0.201812040910"; osgi.identity="org.openhab.binding.unifi"; singleton:="true"
at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]