[ST Edge] Issue with the atmospheric pressure default library

Hello @nayelyz,

The accuracy of the atmospheric pressure information is very poor, (1 kPascal = 10 milli Bars).

Viewing the logs, the sensor sends the measurement with much more precision (1 mBars). It goes to kPascal dividing by 10 and rounding with math.floor () in order to it enters in the range of 0 to 110 kPa of the stock capability.

local pressure_value_attr_handler = function (driver, device, value, zb_rx)
  local kPa = math.floor (value.value / 10)
  device: emit_event (capabilities.atmosphericPressureMeasurement.atmosphericPressure ({value = kPa, unit = "kPa"}))
2021-11-14T19:09:25.145465484+00:00 INFO Zigbee Temp Humidity Sensor v2.3 <ZigbeeDevice: b40690d8-bbee-4f0e-affb-6885dca374c4 [0x7463] (Aqara Weather)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x7463, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: PressureMeasurement >, lqi: 0xFF, rssi: -61, body_length: 0x0011, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x3A, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Int16, MeasuredValue: 1011 >, < AttributeRecord || AttributeId: 0x0014, DataType: Int8, Scale: -1 >, < AttributeRecord || AttributeId: 0x0010, DataType: Int16, ScaledValue: 10111 > > > >
2021-11-14T19:09:25.154597256+00:00 TRACE Zigbee Temp Humidity Sensor v2.3 Found ZigbeeMessageDispatcher handler in st-zigbee-motion
2021-11-14T19:09:25.158213814+00:00 INFO Zigbee Temp Humidity Sensor v2.3 Executing ZclClusterAttributeValueHandler: cluster: PressureMeasurement, attribute: MeasuredValue
2021-11-14T19:09:25.162156200+00:00 INFO Zigbee Temp Humidity Sensor v2.3 <ZigbeeDevice: b40690d8-bbee-4f0e-affb-6885dca374c4 [0x7463] (Aqara Weather)> emitting event: {“component_id”:“main”,“capability_id”:“atmosphericPressureMeasurement”,“state”:{“value”:101,“unit”:“kPa”},“attribute_id”:“atmosphericPressure”}

With @milandjurovic71 have tried a custom capability to show atmospheric pressure in mBar and works well.

But it would be easier to remove the math.floor () so that it displays the information in kPa with 1 decimal place, since it is a numeric type and should allow decimals, but the standard presentation should prevent decimals from being displayed
Emit event is correct in logs, not errors, but shows 0 kPa in app.

2021-11-14T19:04:27.151607398+00:00 INFO Zigbee Temp Humidity Sensor v2.3 <ZigbeeDevice: b40690d8-bbee-4f0e-affb-6885dca374c4 [0x7463] (Aqara Weather)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x7463, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: PressureMeasurement >, lqi: 0xFF, rssi: -62, body_length: 0x0011, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x1A, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Int16, MeasuredValue: 1011 >, < AttributeRecord || AttributeId: 0x0014, DataType: Int8, Scale: -1 >, < AttributeRecord || AttributeId: 0x0010, DataType: Int16, ScaledValue: 10110 > > > >
2021-11-14T19:04:27.160876780+00:00 TRACE Zigbee Temp Humidity Sensor v2.3 Found ZigbeeMessageDispatcher handler in st-zigbee-motion
2021-11-14T19:04:27.163890870+00:00 INFO Zigbee Temp Humidity Sensor v2.3 Executing ZclClusterAttributeValueHandler: cluster: PressureMeasurement, attribute: MeasuredValue
2021-11-14T19:04:27.168215448+00:00 INFO Zigbee Temp Humidity Sensor v2.3 <ZigbeeDevice: b40690d8-bbee-4f0e-affb-6885dca374c4 [0x7463] (Aqara Weather)> emitting event: {“component_id”:“main”,“capability_id”:“atmosphericPressureMeasurement”,“state”:{“value”:101.1,“unit”:“kPa”},“attribute_id”:“atmosphericPressure”}
2021-11-14T19:04:27.181023849+00:00 DEBUG Zigbee Temp Humidity Sensor v2.3 Aqara Weather device thread event handled
2021-11-14T19:04:50.501043659+00:00 TRACE Zigbee Temp Humidity Sensor v2.3 Received event with handler zigbee health poll

Couldn’t this stock presentation be modified in order to give an acceptable precision for atmospheric pressure, showing xxx.x kPa?

Thanks

Do you mean it should display the value with one decimal place in the device history but hide it in the detail view?

Is this the custom or stock capability?
Have you checked the capability value in the ST API?
Get the device id (b40690d8-bbee-4f0e-affb-6885dca374c4) and query the device status

No,
I mean that the stock capability should show the pressure in kPa with one decimal place, since it is defined as numeric type and the stock presentation seems not to allow it.

In stock capability show 0, but the log cat show emitted event (101.1 kPa) without errors

2021-11-14T19:04:27.151607398+00:00 INFO Zigbee Temp Humidity Sensor v2.3 <ZigbeeDevice: b40690d8-bbee-4f0e-affb-6885dca374c4 [0x7463] (Aqara Weather)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x7463, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: PressureMeasurement >, lqi: 0xFF, rssi: -62, body_length: 0x0011, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x1A, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Int16, MeasuredValue: 1011 >, < AttributeRecord || AttributeId: 0x0014, DataType: Int8, Scale: -1 >, < AttributeRecord || AttributeId: 0x0010, DataType: Int16, ScaledValue: 10110 > > > >
2021-11-14T19:04:27.160876780+00:00 TRACE Zigbee Temp Humidity Sensor v2.3 Found ZigbeeMessageDispatcher handler in st-zigbee-motion
2021-11-14T19:04:27.163890870+00:00 INFO Zigbee Temp Humidity Sensor v2.3 Executing ZclClusterAttributeValueHandler: cluster: PressureMeasurement, attribute: MeasuredValue
2021-11-14T19:04:27.168215448+00:00 INFO Zigbee Temp Humidity Sensor v2.3 <ZigbeeDevice: b40690d8-bbee-4f0e-affb-6885dca374c4 [0x7463] (Aqara Weather)> emitting event: {“component_id”:“main”,“capability_id”:“atmosphericPressureMeasurement”,“state”:{“value”:101.1,“unit”:“kPa”},“attribute_id”:“atmosphericPressure”}

I don’t know what you mean by this, I’m sorry

@nayelyz

When I was playing with the Aqara temperature sensors quite some time ago now, which support Atmospheric Pressure Measurement, I found that not only did the app plugin incorrectly expect an integer as the value for the details view, but if it didn’t get an integer it didn’t even attempt to do something sensible like round it or truncate it, it just replaced it with 0. It sounds like that is still the case.

The irony was that despite throwing a wobbly with anything but an integer, which is absolutely absurd for a unit of kPa, the plugin actually couldn’t give a monkey’s what the unit was. As you could get away with just about anything in a device handler that meant you could use a sensible unit instead.

It would make a lot more sense if the capability used hectoPascals as the default unit as that is what meteorologists tend to use (equivalent to millibars). However there are a number of other units that should also be accepted, including the good old inches or millimetres of mercury.

Yes, I just want to confirm the value was saved correctly, that’s why I need your help checking the device status, please. Here’s an example using Postman:

  1. This is a GET request to https://api.smartthings.com/v1/devices/device-id/status.
    You just need to replace device-id with the actual value.
  2. Replace PAT in the Authorization tab with your Personal Access Token

You can use this endpoint to check the current value of all the capabilities that belong to the device.

:thinking: That’s odd. However, as this capability is in a “proposed” state, there might be inconsistent behavior like you described.
Using a custom capability is an excellent workaround in this case, but I’ll see if I can get more info about it and share your comments with the engineering team

Sorry, I can’t help you with that, because I don’t have that device, the device and the logs are from the tests made by @milandjurovic71