Hi all,
Looks like Openhab dosent support the Number Density that matches air things. I changed the item to a Number and im finally getting the numeric value from the device.
However its reporting 36 which i believe is in Bq/m3. However i want to display it in pCi/L.
How do i convert the 36 to the 0.972
1 Bq/m3 = 0.0270 pCi/L
I don’t use the AirThings add-on because it’s a huge pain to get Bluetooth inside a Docker container and I never had it working reliably when I installed it on an RPi. So I use GitHub - Drolla/WavePlus_Bridge: Airthings Wave Plus Bridge to Wifi/LAN and MQTT, but face the same issue. For some reason I cannot fathom, it shows pCi/L in the app but reports Bq/m³ via the API.
I’ve just kept it as Bq/m³ because all I really care about is the relative levels and whether it’s at a level I need to worry about (since installing the remediation I’ve been green).
Since pCi/L isn’t supported by the upstream library that provides UoM support, if you want to convert it you will have to do the following:
Redefine the Item as Number
Create a SCRIPT transformation to convert the received Bq/m³ to pCi/L
Apply that transformation as a transform Profile on the link between the Thing and the Item.
I don’t think it will cause a problem if you set the State Description Pattern on the Item to %.1f pCi/L but be aware that this Item will not actually carry any units at all. It’ll just be a naked number.
Alternatively:
Create a Number Item to act as the proxy for the reading
Create a rule that triggers when the reading changes and divides the reported Bq/m³ by 0.972 and updates the Item created in 1 with that value.
Do the same as 4 above.
The first approach is a little cleaner.
Here’s the default list item widget I use for the radon readings:
uid: radon_list
tags:
- humidity
- list
props:
parameters:
- description: Widget title
label: Title
name: title
required: false
type: TEXT
- context: item
description: Item to display
label: Item
name: item
required: false
type: TEXT
parameterGroups: []
timestamp: Aug 26, 2022, 9:43:08 AM
component: oh-label-item
config:
action: analyzer
actionAnalyzerCoordSystem: time
actionAnalyzerItems: =[props.item]
icon: iconify:mdi:radioactive
iconColor: '=(Number.parseInt(items[props.item].state) >= 148) ? "red" : (Number.parseInt(items[props.item].state) >= 99.9) ? "orange" : (Number.parseInt(items[props.item].state) >= 51.8) ? "yellow" : "green"'
item: =props.item
title: =props.title
The icon changes colors based on the safety levels that causes the value to change color in the AirThings App. It’s that color that is really the only thing that matters.