(EDGE Driver-Mc): Zigbee Temp Sensor and Child Thermostat Mc, Zigbee Temp Sensor with Thermostat Mc

The date of the latest version is this

Uninstalled and installed again. Same version ā€œ2021-11-09ā€ not ā€œ2021-11-12ā€ and the Battery is still 0%

My is 2021-11-09

When I installed Aqara driver first time, it took until next day to show battery status

It will appear.
It only has a small change in the calculation for underfloor heating with Ā° F.

Is the same Aqara weather model that @milandjurovic71?

I can`t get the exact model number but i think is the same model.

Remove the battery, wait a few minutes for the voltage to rise due to the lack of charge and re-install it.
Letā€™s see if it emits a new value event

@Catalin_S Same model

Good evening
Is it not possible to display the atmospheric pressure in mBar and not in kPascal?
I know that the capabilities.atmosphericPressureMeasurement uses only kPa and integers up to 130 but with this unit of measurement it makes no sense to measure atmospheric pressure

1 Like

Buona serata, Giacomo,

Multiplying the kPascals by 10, they are converted to milli Bars, but in effect you would need 1 decimal place to obtain a useful conversion to milli Bars for atmospheric pressure.
A precision of 10 mb is poor precision.

The default libraries are the ones that handle these events.

1 Like

Iā€™ve been working on it for weeks but canā€™t find a way to convert the units of measure. I know that the dth I used converted it to mbar.

Unfortunately I canā€™t convert the dth to edge. Iā€™m still learning, but I like the new system.

Hello, @GiacomoF

In my driver I use the default libraries to handle atmospheric pressure.

@veonua has an edge driver for the Aqara weather sensor, which he shared, and it uses a handler to emit the atmospheric pressure event and it seems that the value sent by the device is in mBars and it is converted to kPascals (value / 10 ) and then the event is emitted in kPascal.

https://community.smartthings.com/t/edge-driver-for-aqara-temperature-and-humidity-sensor/232858/17?u=mariano_colmenarejo

If it is not divided by 10, when issuing the event the libraries could give an out of range error. I donā€™t know, since I donā€™t have a sensor to test it.

If this does not work, it is also possible to obtain the last value stored, which will be in mB and send it to a custom capability with text format in mBars.

I donā€™t know if you have the default LUA libraries of the 39x firmware.
They are not updated and There are no atmospheric pressure defaults, but they are essential to see how Hub Edge libraries work and write code.

Letā€™s see if they update with all the defaults and be able to do more things

I found custom capability much more difficult than to convert groovy to Lua.
there are so many little things that can go wrong.

At first the custom capabilities seemed very complicated to me, but now, the basic ones such as a capability with a attribute type string or numericā€¦ and a seter command, are easy for me to handle.

In fact I think that in your driver with create a custom capability:

  • Name: Atm Pressure
  • Attribute: atmPressure
  • Type: number
  • Range 1 to 1500
  • units: mBar

Capability presentation create with this .json file

{
    "dashboard": {
        "states": [
            {
                "label": "{{atmPressure.value}} {{atmPressure.unit}}"
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "Atmospheric Pressure in mBar:",
            "displayType": "state",
            "state": {
                "label": "{{atmPressure.value}}",
                "unit": "atmPressure.unit"
            }
        }
    ],
    "automation": {
        "conditions": [
            {
                "label": "Atmospheric Pressure in mBar:",
                "displayType": "numberField",
                "numberField": {
                    "value": "atmPressure.value",
                    "valueType": "number",
                    "unit": "atmPressure.unit",
                    "range": [
                        1,
                        1500
                    ]
                }
            }
        ],
        "actions": []
    },
    "id": "xxxxxxxxxxxx.atmPressure",
    "version": 1
}

and adding these lines to your code:

-- Custom Capability AtmPressure declaration
local atm_Pressure = capabilities ["xxxxxxxxxxxx.atmPressure"]

-- driver template
local zigbee_temp_driver_template = {
  supported_capabilities = {
    capabilities.relativeHumidityMeasurement,
    capabilities.atmosphericPressureMeasurement,
    atm_Pressure,
    capabilities.temperatureMeasurement,
    capabilities.battery,
    capabilities.temperatureAlarm,

-- attributte handler
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"}))

-- emit even for custom capability in mBar
local mBar = value.value
device: emit_event (atm_Pressure.atmPressure (mBar))

end

With this you would have a device that gives the atmospheric pressure in two different units kPpa and mBar

1 Like

I hope GiacomoF understood what needs to be done. because I donā€™t.

Perfect. I managed. Thanks I learned a new thing.

Iā€™m glad it served for something! :grinning_face_with_smiling_eyes:

You should have achieved something similar to this that @milandjurovic71 tried yesterday, who is always willing to try new things and propose alternatives.

We are looking for another easier solution, which is to show the Kpa with 1 decimal place and that would be equivalent to having mBars without having to use a custom capability

@milandjurovic71 is going to try several things and tell us the result. Thanks Milan!

1 Like

I generate the event in the history. but it does not display it. Display in kPa only. Where am I wrong?

2021-11-15T11:41:17.968428012+00:00 INFO Xiaomi Temperature <ZigbeeDevice: 36086131-c339-44d7-9cac-beebfc386081 [0x1D26] (Temperatura Divano)> emitting event: {ā€œattribute_idā€:ā€œatmPressureā€,ā€œcapability_idā€:ā€œbreathgarden30215.atmPressureā€,ā€œcomponent_idā€:ā€œmainā€,ā€œstateā€:{ā€œvalueā€:1044}}

It seems correct.
Did you create the capability presentation with the .json file?