[ST Edge] Zigbee Illuminance Measurement

@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.

@Benjamin_Ginders the driver working great thanks

@Benjamin → Have you added the fingerprint yet?

Has anyone tested if the Xioami light sensor works?

Yes i have two of them they work well however i use the zigbee illuminance sensor bg driver

Thanks Montyfert - so you have deleted the DTH from IDE, deleted the light sensor device from smartthings, enrolled to Benjamin’s channel, installed his driver (Zigbee Illuminance Sensor BG) and paired your 2 Xiaomi light sensors successfully?

Is it this one Xiaomi Mijia Smart Light Sensor Light Detection Intelligent Linkage Zigbee3.0 you have?

Also, how frequently do they refresh?

hi yes it shows up in smartthings as a xiaomi mijia luminance sensor and settings are
timr between lux reports 60
reported change value 60
both settings can be changed
martin

Detected in no time and the lux works a charm but not sure about the battery value though as it’s showing 100%.

Changed both the values to 1 and the lux is getting reported perfectly.

Many thanks for your re-assurance Martin.

your welcome
the only thing tho changing the values that low might eat the battery.
might be best to keep an eye on the battery see how you go.

Noted Martin but I feel the batter values are reflected incorrectly anyways as it was around 60% before but now showing 100%