Rocken
(Rocken)
March 14, 2023, 12:14pm
1
In the location cards I see badges for temperature, humidity, light, door.
But the badge for Presence does not work.
my simplified setup:
Kitchen (class kitchen)
|-> MotionSensor (class motionDetector)
|-> Contact (class Point_Status, relatesTo Property_Presence)
But if I put it like this
Kitchen (class kitchen)
|-> Contact (class Point_Status, relatesTo Property_Presence)
the badge is shown.
What am I doing wrong here? All the other badges work when put in Equipment.
I read (and followed):
opened 03:24PM - 24 Nov 20 UTC
closed 10:39PM - 28 Nov 20 UTC
enhancement
main ui
This issue discusses the design and features of the header of a location card, w… hen not customized by users using slots.
As a semantic card it inherits a number of common properties described in #555 (like background color/image).
## Title
By default, the title is the label of the item (or its name if it has none).
## Subtitle
If the location has a parent, the label or name of the parent is the default (but it should be possible to remove it, for instance if the cards are manually put in groups by the user (see #555).
## At-a-glance modules
The built-in at-a-glance modules (or "complications" as in watch screens) use the semantic model to gather information about the location and display it in a summarized manner with little icons and eventually a short label, "rewarding" the time taken to build a well-designed model by automatically providing information in the header of the card. The goal is not to be exhaustive, rather cover what should be the most popular scenarios. There will still of course be cases outside this anticipated well-known scenarios, and esoteric needs; therefore ideally users should be able to customize these modules, or add more (with slots). It should also be possible to hide automatically shown modules that doesn't work well or aren't desired.
A location card with all modules having something to display should resemble the following example ("worst case scenario"):
![image](https://user-images.githubusercontent.com/2004147/100102623-265a6e00-2e64-11eb-8e58-59b2d71e6506.png)
It is a little busy, but the average card should be much less so since a module isn't displayed when there is nothing to show.
### General principles for querying data from the model
- Normally the user will have put Equipment in the Locations. Most of these pieces of equipment will have Points. Gathering states from Points is always preferred as opposed to gathering states from Equipment item themselves, but we do it anyway if we couldn't find any matching Point. For instance, for blinds, look for OpenState points in equipment tagged Blinds (the preferred default), but if we can't find any, analyze the state of the Equipment items themselves - and consider a state of OPEN, or CLOSED appropriately.
- In order to leave out any ambiguity about which Points to consider, the admin has the option of relating Points directly to the Location without any Equipment in between. There are many ways to do it:
* a Point can be made a member of both its parent Equipment, and also the Location it's in.
* the item could be duplicated at the Location level and linked to the same channel so that it reflects the same data
* a Group with an aggregation function (e.g. average) can be added as a Point to the Location to compute a state for the location from the state of the desired items.
<br />we should therefore prioritize the results by considering first only the Points which have a direct _hasLocation_ relation to the location; but if none match, we can consider those indirectly related through their equipment items.
### Built-in glance modules
#### ![image](https://user-images.githubusercontent.com/2004147/100102773-57d33980-2e64-11eb-963d-a109917144ba.png) Number of alarms (after the title)
__Point_Alarm__ _hasLocation_ __(the location)__
___If no matching item found:___
__Point_Alarm__ _isPointOf_ __(any equipment)__ _hasLocation_ __(the location)__
Count those with the state `ON`: if any result, display the count after the title as shown.
#### ![image](https://user-images.githubusercontent.com/2004147/100103443-332b9180-2e65-11eb-9031-43e4ff910145.png) Nb. Lights on
__Point_Control*__ _relatedTo_ __Property_Light__ _hasLocation_ __(the location)__ with the state
___If no matching item found:___
__Point_Control*__ _relatedTo_ __Property_Light__ _isPointOf_ __(any equipment)__ _hasLocation_ __(the location)__
Count those with the state `ON`, integer>0 or H,S,B with B > 0: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100104468-80f4c980-2e66-11eb-9a3e-4fccf906dade.png) Nb. of Open Windows
__Point_Status_OpenState__ _isPointOf_ __Equipment_Window__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_Window__ _hasLocation_ __(the location)__
Count those with the state `OPEN`: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100105088-42134380-2e67-11eb-8c95-3c20a27e4438.png) Nb. of Open Doors
__Point_Status_OpenState__ _isPointOf_ __Equipment_Door__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_Door__ _hasLocation_ __(the location)__
Count those with the state `OPEN`: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100105203-60793f00-2e67-11eb-881b-4b56a20f9589.png) Nb. of Open Garage Doors
__Point_Status_OpenState__ _isPointOf_ __Equipment_GarageDoor__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_GarageDoor__ _hasLocation_ __(the location)__
Count those with the state `OPEN`: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100105349-89013900-2e67-11eb-9c37-2b4bc3c2acf4.png) Nb. of Open Blinds
__Point_Status_OpenState__ _isPointOf_ __Equipment_Blinds__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_Blinds__ _hasLocation_ __(the location)__
Count those with the state `OPEN` or integer=0: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100105840-18a6e780-2e68-11eb-99ab-59db6bd18ae8.png) Presence Detected
__Point_Status__ _relatedTo_ __Property_Presence__ _hasLocation_ __(the location)__
___If no matching item found:___
__Point_Status__ _relatedTo_ __Property_Presence__ _isPointOf_ __(any equipment)__ _hasLocation_ __(the location)__
If any result has the state `ON` or `OPEN`, display the icon.
#### ![image](https://user-images.githubusercontent.com/2004147/100106269-a682d280-2e68-11eb-893e-22ec7dcfaab0.png) Locks
__Point_Status__ or __Point_Control*__ _isPointOf_ __Equipment_Lock__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_Lock__ _hasLocation_ __(the location)__
If all results have the state `CLOSED` or `OFF`: display ![image](https://user-images.githubusercontent.com/2004147/100107368-da122c80-2e69-11eb-8309-a5e35b0ac90f.png)
If any result has the state `ON` or `OPEN`: single result, display the icon ![image](https://user-images.githubusercontent.com/2004147/100106269-a682d280-2e68-11eb-893e-22ec7dcfaab0.png); multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100107597-18a7e700-2e6a-11eb-835a-9cae2c5e916a.png) Climate Control Powered On (A/C, Heating)
__Point_Status__ or __Point_Control*__ __relatedTo_ __Property_Power__ _isPointOf_ __Equipment_HVAC__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_HVAC__ _hasLocation_ __(the location)__
If any result has the state `ON`, display the icon.
#### ![image](https://user-images.githubusercontent.com/2004147/100108170-ca471800-2e6a-11eb-89f5-2b6ac2b83ff5.png) Nb. of Screens Powered On
__Point_Status__ or __Point_Control*__ __relatedTo_ __Property_Power__ _isPointOf_ __Equipment_Screen__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_Screen__ _hasLocation_ __(the location)__
Count those with the state `ON`: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100108678-55c0a900-2e6b-11eb-9a46-073f96633e94.png) Nb. of Speakers/AV Receivers Powered On
__Point_Status__ or __Point_Control*__ __relatedTo_ __Property_Power__ _isPointOf_ __Equipment_Speaker__ or __Equipment_Receiver__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_Speaker__ or __Equipment_Receiver__ _hasLocation_ __(the location)__
Count those with the state `ON`: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100108973-a89a6080-2e6b-11eb-91ed-d34c7094bcf1.png) Nb. of Projectors Powered On
__Point_Status__ or __Point_Control*__ __relatedTo_ __Property_Power__ _isPointOf_ __Equipment_Projector__ _hasLocation_ __(the location)__
___If no matching item found:___
__Equipment_Projector__ _hasLocation_ __(the location)__
Count those with the state `ON`: single result, display the icon only; multiple results, display the icon and the count.
#### ![image](https://user-images.githubusercontent.com/2004147/100109449-22324e80-2e6c-11eb-94aa-c24ec0a72918.png) Temperature (Measurement & Setpoint)
##### Measurement part:
__Point_Measurement__ _relatedTo_ __Property_Temperature__ _hasLocation_ __(the location)__
___If no matching item found:___
__Point_Measurement__ _relatedTo_ __Property_Temperature__ _isPointOf_ __(any equipment)__ _hasLocation_ __(the location)__
Compute the average of the valid values (if single result, take the result a fortiori), and display if valid.
##### Setpoint part:
__Point_Setpoint__ _relatedTo_ __Property_Temperature__ _hasLocation_ __(the location)__
___If no matching item found:___
__Point_Setpoint__ _relatedTo_ __Property_Temperature__ _isPointOf_ __(any equipment)__ _hasLocation_ __(the location)__
There should be only one result in theory; out of an abundance of caution, compute the average of the valid values (if single result, take the result a fortiori), and display if valid between parentheses after the measurement.
#### ![image](https://user-images.githubusercontent.com/2004147/100110410-30349f00-2e6d-11eb-8ac0-45b2211f3a31.png) Humidity (Measurement)
__Point_Measurement__ _relatedTo_ __Property_Humidity__ _hasLocation_ __(the location)__
___If no matching item found:___
__Point_Measurement__ _relatedTo_ __Property_Humidity__ _isPointOf_ __(any equipment)__ _hasLocation_ __(the location)__
Compute the average of the valid values (if single result, take the result a fortiori), and display if valid.
#### ![image](https://user-images.githubusercontent.com/2004147/100112490-928e9f00-2e6f-11eb-8d77-70a8835b3ab3.png) Luminance/Ambient Light (Measurement)
__Point_Measurement__ _relatedTo_ __Property_Light__ _hasLocation_ __(the location)__
___If no matching item found:___
__Point_Measurement__ _relatedTo_ __Property_Light__ _isPointOf_ __(any equipment)__ _hasLocation_ __(the location)__
Compute the average of the valid values (if single result, take the result a fortiori), and display if valid.
Platform information:
running in a docker
openHAB version: 4.0.0.M1 - Milestone Build
Rocken
(Rocken)
March 14, 2023, 5:10pm
2
Is this problem similar to this issue here?
opened 11:08AM - 27 Dec 20 UTC
closed 03:50PM - 08 Jan 21 UTC
bug
main ui
<!--
Please DO NOT ERASE this template, but fill in the details as requested. T… his will ensure your issue is properly filed and will be considered. Otherwise, we may reserve the right to close it without further action.
-->
## Alarm badge not shown for points part of equipment
<!--
Describe the issue you're having. In most cases it is appreciated to share screenshots or
even animated GIFs of your issue.
To make screenshots:
* On Windows: use Win+Shift+S
* On macOS: use Cmd+Shift+4
To make animated GIFs we recommend:
* On Windows: ShareX - https://getsharex.com/
* On macOS: Giphy Capture - https://giphy.com/apps/giphycapture
* On GNU/Linux: Peek - https://github.com/phw/peek
-->
According to #556 alarm badges should work like this:
**Point_Alarm** _hasLocation_ **(the location)**
**_If no matching item found:_**
**Point_Alarm** _isPointOf_ **(any equipment)** _hasLocation_ **(the location)**
But in OH3.0 alarm badge is just shown, when **Point_Alarm** _hasLocation_ **(the location)**.
Second option with **Point_Alarm** _isPointOf_ **(any equipment)** _hasLocation_ **(the location)** does not work.
See: https://github.com/openhab/openhab-webui/blob/master/bundles/org.openhab.ui/web/src/components/cards/glance/location/status-badge.vue
Line 156
```
case 'alarms':
return findPoints(this.element.properties, 'Point_Alarm', true)
```
Compared to e.g. the code for lightbulb badge (which is working as expected) the second part seems to be missing
Line 63
```
case 'lights':
direct = findPoints(this.element.properties, 'Point_Control', true, 'Property_Light')
if (direct.length) return direct
return findPoints(allEquipmentPoints(this.element.equipment), 'Point_Control', true, 'Property_Light')
```
## Expected behavior
<!--
Describe what you expected to happen or how it should look/behave.
-->
**Point_Alarm** _isPointOf_ **(any equipment)** _hasLocation_ **(the location)** should lead to expected number of active alarms shown on location cards
## Steps to reproduce
<!--
Provide accurate steps to reproduce the issue, including pastes of widget/page code if necessary.
-->
1. Create items (via .items file or UI)
```
// Points attached to Equipment
Group g1 "Group Location 1" ["Room"]
Group e1 "Group Equipment 1 for L1" (g1) ["Siren"]
Switch s1 "Switch 1 for E1" (e1) ["Alarm", "Temperature"]
Switch s2 "Switch 2 for E1" (e1) ["Alarm", "Temperature"]
// Points straight under Location
Group g2 "Group Location 2" ["Room"]
Switch s3 "Switch 3 for L2" (g2) ["Alarm", "Temperature"]
Switch s4 "Switch 4 for L2" (g2) ["Alarm", "Temperature"]
```
2. Set all 4 switches to ON
3. Go to `Location` tab and check of the badge is shown in both cases
## Your environment
<!--
As an admin, in the main UI, choose *Help & About* on the left sidebar, expand *Technical information* and click on *View details*, then click *Copy* and paste the results here. You may omit information that is not pertinent to this issue if you feel it's divulging information you'd like not to share.
-->
```yaml
runtimeInfo:
version: 3.0.0
buildString: Release Build
locale: de_DE
systemInfo:
configFolder: /openhab/conf
userdataFolder: /openhab/userdata
logFolder: /openhab/userdata/logs
javaVersion: 11.0.9
javaVendor: Azul Systems, Inc.
javaVendorVersion: Zulu11.43+21-CA
osName: Linux
osVersion: 3.10.105
osArchitecture: amd64
availableProcessors: 4
freeMemory: 681346656
totalMemory: 834666496
bindings:
- ...
clientInfo:
device:
ios: false
android: false
androidChrome: false
desktop: true
iphone: false
ipod: false
ipad: false
edge: false
ie: false
firefox: true
macos: false
windows: false
cordova: false
phonegap: false
electron: false
nwjs: false
webView: false
webview: false
standalone: false
pixelRatio: 1
prefersColorScheme: light
isSecureContext: false
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: N/A
hardwareConcurrency: 4
language: de
languages:
- de
- en-US
- en
onLine: true
platform: Linux x86_64
screen:
width: 1280
height: 1024
colorDepth: 24
support:
touch: false
pointerEvents: true
observer: true
passiveListener: true
gestures: false
intersectionObserver: true
themeOptions:
dark: light
filled: true
pageTransitionAnimation: default
bars: filled
homeNavbar: default
homeBackground: default
expandableCardAnimation: default
userAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0
timestamp: 2020-12-27T11:01:39.476Z
```
Additional hint: OH3.0 hosted with Docker on Synology NAS
## Browser console
<!--
Open the developer tools in your browser, go to the Console tab and paste errors and other messages that might be relevant to this issue.
You may also paste a screenshot if you prefer.
-->
```txt
Uncaught (in promise) DOMException: The operation is insecure. app.js:27
```
## Browser network traffic
<!--
Open the developer tools in your browser, go to the Network tab and paste
screenshots of the network traffic and the details of individual requests that failed.
-->
## Additional information
<!--
Provide any information not pertinent to the above sections that you'd still like to share.
-->
See also https://community.openhab.org/t/oh3-representation-of-semantic-model-in-mainui/111020
JustinG
(JustinG)
March 14, 2023, 6:06pm
3
I’m also on 4.0M1 in docker and my presence items inside equipment properly display badges on the location cards. The problem here is most likely in some of the finer details of your item configurations, but you haven’t shown us those.
Rocken:
my simplified setup:
In general, this is not actually helpful. As in this case, attempting to simplify the information actually leaves out all the relevant pieces. Don’t worry about flooding the topic with info, the more the better, because the more likely someone can see the issue right away. Give us everything.
JustinG
(JustinG)
March 14, 2023, 8:13pm
5
I have my equipment as just a “Sensor” semantic class not a specific “MotionDetector” class. See if that makes a difference, and if so then you should probably file a issue in the UI repo, because I would expect a motion detector class equipment to trigger the motion badge as well.
Rocken
(Rocken)
March 14, 2023, 8:35pm
6
Putting it as a sensor (only) did not help.
Here [Design/Spec] Location semantic cards: header · Issue #556 · openhab/openhab-webui · GitHub it is mentioned that it should work with any equipment
→ I will open an issue
Rocken
(Rocken)
November 2, 2023, 6:33pm
8
Problem seems to be fixed now
I set the sematic class to “Measurement” and then back to “Status”.
I am now on openHAB 4.1.0.M2