- Platform information: OpenHABian running 3.0
Just a question about two features I always wanted to achieve in sitemaps and HABPanel, but never seemed to be possible/easy. Hoping I can do it in the new MainUI. Apologies if I’m using the wrong terminology.
1 - I’d like to add a URL to Equipment definitions that can expose a button to link to the device’s management console. For example, be able to navigate directly to a ping device or a Tasmota web console.
2 - Second - I’d like to be able to be able to add metadata for a device’s preferred access point, so if it connects to the ‘wrong’ access point, I can either send an alert or programmatically resolve it with the UniFi binding.
I know of no way to achieve this. That doesn’t mean it’s not possible but I don’t know how it would be achieved.
How is OH supposed to figure that out? What event will OH receive from what binding will tell it that a device has connected to the wrong access point? Answer that and you will probably find your path to a solution.
The “Compare value to Point?” part of your topic title seems unrelated to the contents of the post. Did you have another question?
Thanks - and apologies for the vague title. I spent more time proofing the body.
For #2, At the moment, I have an item that gets populated from a binding, and I have a similarly named item ‘bootstrapped’ with its preferred value. I can then use a rule to compare the two or visually inspect. It just seems kludgy to have to have a bunch of additional items where maybe the data could be stored as metadata somehow on the item that gets populated from the binding.
To date no bindings populate any Item metadata. I’m not even sure that’s a good idea frankly because Items are intended to be independent from the Thing. Items are the normalization of your devices so a Switch from Zwave is identical to a Switch from KNX once it’s an Item. If an Item were to encode data like this, it would most likely make it available as Channel, which means you’ll still have those extra Items. Or alternatively they would create an Action to call from your rule which is a reasonable approach. But the binding authors would have to implement it.
Furthermore, you can’t trigger a Rule with Metadata, so what event would occur to trigger a rule to send the alert?
Having said all that, you can set metadata on the Items yourself. And if you use any of the other languages besides Rules DSL you can access that Item metadata. It’s super easy if you use the Helper Libraries and it’s not so hard if you are not. Then you can check that metadata in a rule that gets triggered when that Item changes. You could also encode the preferred APs in a map in a library file somewhere (configruation.js for example) or even as a constant in the rule file itself.
Another approach would be to encode the information into the name of the Item. See Design Pattern: Encoding and Accessing Values in Rules
You could do this by creating a String item as a point under the Equipment, you could initialize it with a start up rule that sets the correct URL value. You can then use this item to retrieve the URL when an action / event occurs.
A similar principle to (1) can be applied in that you can create a string item to hold the preferred SSID. The issue is how you get the current SSID that the device is connected to. If the device exposes the currently connected SSID then you could have your rule check to see if it matches the state of the item holding the preferred SSID.
In effect, you would be using Items to hold global variables / constants for checking against.