Skip to content

Commit

Permalink
Add CO2 measurement badge to location card
Browse files Browse the repository at this point in the history
Signed-off-by: David Kesl <[email protected]>
  • Loading branch information
Davek145 committed Sep 14, 2023
1 parent 07aacc9 commit a9f0ef3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions bundles/org.openhab.ui/doc/components/oh-location-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ A card showing model items in a certain location
<PropOption value="speakers" label="Speakers/AV Receivers Powered On" />
<PropOption value="temperature" label="Average Temperature (+ Setpoint)" />
<PropOption value="humidity" label="Average Humidity" />
<PropOption value="co2" label="Average CO2" />
<PropOption value="luminance" label="Average Luminance" />
</PropOptions>
</PropBlock>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const OhLocationCardParameters = () => new WidgetDefinition('oh-location-
{ value: 'speakers', label: 'Speakers/AV Receivers Powered On' },
{ value: 'temperature', label: 'Average Temperature (+ Setpoint)' },
{ value: 'humidity', label: 'Average Humidity' },
{ value: 'co2', label: 'Average CO2' },
{ value: 'luminance', label: 'Average Luminance' }
], true, true)
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default {
badgeConfigs: {
temperature: { icon: 'f7:thermometer', unit: '°' },
humidity: { icon: 'f7:drop', unit: '%' },
co2: { icon: 'f7:wind', unit: 'ppm' },
luminance: { icon: 'f7:sun_min', unit: 'lx' }
}
}
Expand All @@ -59,6 +60,10 @@ export default {
direct = findPoints(this.element.properties, 'Point_Measurement', true, 'Property_Humidity')
if (direct.length) return direct
return findPoints(allEquipmentPoints(this.element.equipment), 'Point_Measurement', true, 'Property_Humidity')
case 'co2':
direct = findPoints(this.element.properties, 'Point_Measurement', true, 'Property_CO2')
if (direct.length) return direct
return findPoints(allEquipmentPoints(this.element.equipment), 'Point_Measurement', true, 'Property_CO2')
case 'luminance':
direct = findPoints(this.element.properties, 'Point_Measurement', true, 'Property_Light')
if (direct.length) return direct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</span>
</div>
<div class="location-stats margin-top-half" v-if="!config.disableBadges">
<span v-for="badgeType in ['temperature', 'humidity', 'luminance']" :key="badgeType">
<span v-for="badgeType in ['temperature', 'humidity', 'co2', 'luminance']" :key="badgeType">
<measurement-badge v-if="!config.badges || !config.badges.length || config.badges.indexOf(badgeType) >= 0"
:store="context.store" :element="element" :type="badgeType" :invert-color="config.invertText" :badgeOverrides="badgeOverrides" />
</span>
Expand Down

0 comments on commit a9f0ef3

Please sign in to comment.