[ST Edge] Zigbee Illuminance Measurement

Hi @mvevitsis I have closed my laptop for the night now (it’s 23:12 here) will run some further tests tomorrow and then post on my GitHub also on a public channel.

1 Like

You are welcome!

If you need it, I’ll give you the code that I use in infoChanged lifecycle to configure the maximum intervals and reportable change in preferences and the code to reconfigure the device when the value in preferences is changed.

Or you can also see it on my github for the temperature sensor and others.

https://github.com/Mariano-Github/Edge-Drivers-Beta

Does the formula for conversion to lux works well or does this device already send information in lux?

Hello Benjamin_Ginders
Please post your edge driver your channel please. I’d like to test and use it with my “lumi.sen_ill.mgl01” :slight_smile:
Dusan

Hi,

Please see below channel link for this driver:
https://api.smartthings.com/invite/d429zxAN0Plo

I have not had chance to fully test this yet so please do let me know if you face any issues

Hello,
Installed your driver and repaired the device. It took only 5sec to pair.
Lux measurement works fine ;):hugs::tumbler_glass:
Battery shows 100% but i dont care about batery info :face_with_hand_over_mouth:
If you need any future info about changes you will make just let me know.

Thank you!!!

They only report when the battery is low, there is no periodic reporting as far as I know.

@Benjamin_Ginders does this include fingerprints for both models?

Hi @mvevitsis yes this does include the fingerprint for both models which use the LUMI manufacturer tag.

The battery functionality is something I am still trying to figure out.

One way to test would be to power it using a lower voltage, say 2.5v and see if it reports something.
Either using a bench power supply or a drained battery.

It should start reporting at some point I just don’t know how low it has to be.

One thing that annoys me about lumi devices is that they only report voltage and not percentage. But at least they are using standard clusters now.

@Benjamin_Ginders Thank you for your hard work and for sharing your Edge Driver, it really is appreciated.

Hello @Benjamin_Ginders,

The battery is configured with the default values ​​and reports the changes every 21600 sec or any change in voltage> = 0.1 v.
As a change of 0.1v may not imply a % change, you could add the voltageMeasurement capability in the profile .yml file and it would show you the battery voltage sent by the device.

In the profile file you add the capacity, after illuminance capability:

  - id: voltageMeasurement
    version: 1
  • Do not add the capability voltageMeasurement in the init.lua Template., so the configuration is not carried out and it does not give errors of unsupported cluster.
  • In the battery handler function, add Emit Battery voltage event, prior to the emission of the battery % event:
local battery_handler = function(driver, device, value, zb_rx)
-- Emit Battery voltage event
device:emit_event(capabilities.voltageMeasurement.voltage(value.value / 10))

  local batteryMap = {[28] = 100, [27] = 100, [26] = 100, [25] = 90, [24] = 90, [23] = 70,
                    [22] = 70, [21] = 50, [20] = 50, [19] = 30, [18] = 30, [17] = 15, [16] = 1, [15] = 0}
  local minVolts = 15
  local maxVolts = 28

  value = utils.clamp_value(value.value, minVolts, maxVolts)

--- Emit percentage Battery remaining event
  device:emit_event(battery.battery(batteryMap[value]))
end
  • To top it off you can make a presentation VID to limit the voltage range from 0V to 3v in the capability voltageMeasurement and you would have the voltage bar limited to the values ​​shown.

It would look really cool and you would have a battery event with any change > = 0.1 v

2 Likes

Thanks as always @Mariano_Colmenarejo I am currently trying to create the capability presentation but getting “Request failed with status code 403” when submitting the json in the CLI

Hello Benjamin,

If it is for the presentation of the voltage capability, I managed to do VID with a range from 0v to 3.5v, but the range has no effect on automation conditions or on the color bar.

I commented it to @nayelyz
https://community.smartthings.com/t/smartthings-edge-developer-beta-known-issues-and-bug-tracking/230389/99?u=mariano_colmenarejo

This is the .json file that I used, it may be worth changing the waterSensor capability to Illuminance and removing Temperature

{
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "waterSensor",
                "version": 1,
                "idx": 0,
                "group": "main",
                "values": [],
                "composite": false
            }
        ],
        "actions": []
    },
    "detailView": [
        {
            "component": "main",
            "capability": "waterSensor",
            "version": 1,
            "values": [],
            "patch": []
        },
        {
            "component": "main",
            "capability": "temperatureMeasurement",
            "version": 1,
            "values": [],
            "patch": []
        },
        {
            "component": "main",
            "capability": "voltageMeasurement",
            "version": 1,
            "values": [
                {
                    "key": "voltage",
                    "enabledValues": [],
                    "range": [
                        0,
                        3.5
                    ]
                }
            ],
            "patch": []
        },
        {
            "component": "main",
            "capability": "battery",
            "version": 1,
            "values": [],
            "patch": []
        },
        {
            "component": "main",
            "capability": "refresh",
            "version": 1,
            "values": [],
            "patch": []
        }
    ],
    "automation": {
        "conditions": [
            {
                "component": "main",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            },
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            },
            {
                "component": "main",
                "capability": "voltageMeasurement",
                "version": 1,
                "values": [
                    {
                        "key": "voltage",
                        "enabledValues": [],
                        "range": [
                            0,
                            3.5
                        ]
                    }
                ],
                "patch": [],
                "exclusion": []
            },
            {
                "component": "main",
                "capability": "battery",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            }
        ],
        "actions": []
    },
    "type": "profile"
}

Hey! I have tried to use this driver as Benjamin has done, but my sensor only finds the driver smartthings has released and it does not register lux. do you have any tips?

Markus

Hey Benjamin.
Just tried your driver for Zigbee Luminance Sensor (The current DHT is: Illuminance Measurement Capability) but cant find the device.
Would you mind to edit and add this one please?

Data
application:
44
endpointId:
01
manufacturer:
_TYZB01_4mdqxxnn

model:
TS0222

zigbeeNodeType:
SLEEPY_END_DEVICE

Raw Description
01 0104 0106 01 04 0000 0400 0001 0500 02 0019 000A

Thank you!

Hallo ! Is it possible to add this fingerprint too your edge driver so my illuminance works :grinning:

  • application: 1B
  • endpointId: 01
  • manufacturer: XIAOMI
  • model: lumi.sen_ill.mgl01
  • zigbeeNodeType: SLEEPY_END_DEVICE
    Raw Description 01 0104 0106 01 04 0000 0400 0003 0001 01 0003

Markus

Hey @Markusjonsson & @Coelhorj I have now added both fingerprints to the driver, please check and let me know if any issues

1 Like

Ty dude!
Working all right
Are you updated about illuminance parameters issue?

Example:

As you set the illuminance AS fixed value…

You get the local automation condition normally:

But if you use the “Equals our Less” / “Equals or More”

then… you lost the Local condition! :frowning:

This is crazy because it´s not just this sensor buy both Illuminance i own including the AQARA one have same issue

I have just checked with some other edge devices like dimmer switches and lights with a trigger condition with greater or less than, all of which do not show local.

So I would assume that all Edge drivers are the same.

Hi Benjamin,

Just came across this thread now and I also have a Xiaomi light sensor and this is the fingerprint. Please can you add this one too?

  • application: 15
  • endpointId: 01
  • firmwareFullVersion: 00000015
  • firmwareImageType: 9096
  • firmwareManufacturerCode: 4718
  • manufacturer: LUMI
  • model: lumi.sen_ill.mgl01
  • zigbeeNodeType: SLEEPY_END_DEVICE

Raw 01 0104 0106 01 04 0000 0400 0003 0001 01 0003

how do i add TS0222 in ST. I’m a layman on the subject, he recognized it as Things, I tested several manufacturers and none measures the lumens. thank you for the help.