Xiaomi Aqara stuff Works Natively

Cheers for that. Seems that the round sensor will show variables of temp and humidity in variables but will not add child, either manually or by its self. I have had the round one for a year and a half so it was worth a try. I can still access the vars so half working.

I have tried editing therealdb code to update the Tripped var in the door sensor but with no luck.

Nice, that works as well. Im not familiar with “therealdb code”, whats that?

If you change the Param ‘ device_type’ to urn:schemas-micasaverde-com:device:DoorSensor:1

And the Param ‘device_file’ to D_DoorSensor1.xml

And the Param ‘device-json’ to D_DoorSensor1.json

The device will then show up as a door sensor instead of a generic device. Then you can arm the sensor and also use it in regular scenes for triggering when the Status changes.

Is this what you are looking for?

The code in post 37 above.

I have already updated the D_DoorSensor1 elements, and have the correct icon and armed updating.
The issue i have is i need to add a tripped variable and update it with the status var. This is so the sensor trips when armed can be used. I asked you as you mentioned a listener in post 43 above.

Ah oke, like this: (in the startup code)

function updateSecurityStatus(dev_id, service, variable, oldValue, newValue)
    if tonumber(oldValue) ~= tonumber(newValue) then
        luup.variable_set( "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", newValue, dev_id)
    end
end
luup.variable_watch("updateSecurityStatus",  "urn:upnp-org:serviceId:SwitchPower1", "Status", <your_device_id>)
1 Like

Yes, Thank you. I was getting the wrong serviceId.

I have ordered an aquara switch/button. I will post how I get on with that.

i will test some stuff i just got a second V+ to use as a test unit

I’ve just tried to get this working and get battery status showing up, but I couldn’t get it working using this method, I’m probably doing something wrong.

I have however got it working my own way as follows.

I have the Xiaomi Aqura Temp and Humidity sensor the square one.

This when added to Vera created a “parent device” a Generic I/O device and two child devices one for the Temp sensor and one for the Humidity sensor etc.

  1. Add a new “BatteryLevel” Variable to each of the child devices.

To do this go to the device then “Advanced” and select the “New Service” tab

image

Enter the following values and then press the Add button and then the Reload Engine button.

New Service: urn:micasaverde-com:serviceId:HaDevice1
New Variable: BatteryLevel
New Value: 0

Repeat this step on any other child devices, so I did this on both the Temp and Humidity sensor child devices.

  1. Create a Vera Scene or PLEG action or whatever to run this LUA code every day or hour or however often you want the battery information to be updated and populated on the child devices from the parent device.

local updateBatteryInfo = luup.variable_get(“urn:micasaverde-com:serviceId:ZigbeeDevice1”, “PowerSourceLevel”, 393)

luup.variable_set(“urn:micasaverde-com:serviceId:HaDevice1”, “BatteryLevel”, updateBatteryInfo,394)

luup.variable_set(“urn:micasaverde-com:serviceId:HaDevice1”, “BatteryLevel”, updateBatteryInfo,395)

return true


Line 1 gets the current battery level from the parent / master device, from the “PowerSourceLevel” variable.

Lines 2 and 3 then set that battery level value on the two child devices into the new “BatteryLevel” variable.

Here you can see on my parent device looking in the variables tab that the “PowerSourceLevel” is currently at 100 %

image

After running my code in the Vera settings - Apps - Develop Apps - Test Lua Code area both of the child devices changed their battery status from 0 % to 100 %

  1. Optional - Hide the parent / master I/O device from the Vera UI7 web GUI.

In the Startup Lua add a line like:

luup.attr_set(“invisible”,“1”,393)

Where ID 393 is your ID number of your parent device.

image

Note:- This new forum seems to change the quotation mark formatting of posted code. If the code doesn’t work, check the quotes are correct.

The battery status is now showing up for these two devices in the Vera Mobile app.

However I was also expecting the same in the Imperihome app but for some reason the battery status is not shown on the devices.

I can however long press on a device and select Details and the battery status is shown there OK, so not sure what’s up with that.

1 Like

thats a good way to do a battery update eithe pledge or reactor, never thought of that. instead of hiding my main gneric IO - just converted it to one of the devices and deleted one of the children. it seems with all zigbee devices since the stack ist complete it creates a endpoint (GenericIO) for the cluster 0000 during config. but on that Generic IO if you change the device type to one of the endpoints i.e D_TemperatureSensor1.xml D_TemperatureSensor1.json it changes the main endpoint to a temp sesor since all the variables are already there and u can disassociate the child from the main endpoint that way u do not have a bunch of Generic IO hidden device. That is totally up to you though

the battery level in the imperihome app could be something with the way the device file was coded

1 Like

Hi

I’ve done what you suggested, I changed the parent Generic IO device in to a temp sensor.

I also added a new BatteryLevel variable to the parent device and updated my Lua code to reflect these changes and I have now deleted the child device temp sensor.

I then removed the child temp sensor widget from the Imperihome app and instead added the parent device / temp sensor in to Imperihome app. However its still not showing a battery icon on the device in Imperihome. I am really not sure why that is.

Oh well least I have gotten rid of one device from the Vera UI7 interface.

Note: I did really struggle to delete the child temp sensor device it would not delete at all.

In the end I think what did it, was I had to uncheck “Embedded” in its Advanced → Params and then ran this in the browser to delete it and its now finally gone.

http://VERA-IP:3480/data_request?id=device&action=delete&device=394

394 being the device number of the device you want to delete.

The parent device now has both “PowerSourceLevel” and “BatteryLevel” variables, the LUA code updates the “BatteryLevel” value from the value of “PowerSourceLevel”

local updateBatteryInfo = luup.variable_get(“urn:micasaverde-com:serviceId:ZigbeeDevice1”, “PowerSourceLevel”, 393)
luup.variable_set(“urn:micasaverde-com:serviceId:HaDevice1”, “BatteryLevel”, updateBatteryInfo,393)
luup.variable_set(“urn:micasaverde-com:serviceId:HaDevice1”, “BatteryLevel”, updateBatteryInfo,395)
return true

yeah i forot the let you know about the embedded part

1 Like

@richie.digital

Did you ever get your Xiaomi Aqara Vibration sensor working in Vera ?

I know there are some Z-Wave ones like the Vision VISEZS5101-5.

no i didnt know what handler / device file to use so i had to get a z-wave first and see how it works but there is still no implementation of a pressure sensor or a tilt sensor for zwave as yet. I thus put that in the parking lot for now. I’m currently working on some older zigbee sensors on my test unit to see if i can get some stuff reporting

but i got this working https://community.getvera.com/t/monoprice-z-wave-plus-shock-detector-and-acceleration-sensor/212154

someone on ebay was selling them for $15

Sounds good but I am in the UK and that sensor is not available for EU frequency I don’t think. That Vision one I mentioned was the only one I could find.

https://www.uk-automation.co.uk/z-wave-shock-and-vibration-sensor/ but its pretty much double the price

I ordered an Aqara mini switch https://www.gearbest.com/smart-home-controls/pp_009395405312.html?wid=1349303

I managed to include device, which showed as a genericIO device.
I have messed with the device type and files.
Also added ButtonMapping variable.
I have not managed to get this device to work.

Has anyone have any ideas what i should try?

you would have to find out ultimately what it does, is it a scene controller, is it a momentary switch, looks like a scene controller with one button. so vera has no device file for a one button scene controller so you would have to create one. u possibly you could use the last update field to trigger stuff

Sadly LastUpdate does not update.

Yes its a scene controller or maybe a remote. when it first configured and i set it to D_SceneController, it asked how many buttons, I inputed 1 and then it asked me to select a scene.

When adding the temp/humdidity sensor, i got no temp or humidity value till i added the cluster 0402/0405. Now im i have seached and tried different cluster values but none seem to work. SO i was wondering if anyone has any suggestions for cluster values for zigbee scene contollers/remotes etc?

yeah i am here reasearching clusters i have a zigbeeMqtt stick i need to set up so i can do some scanning but the problem it the cluster mappings

1.1.1 General

The General clusters implemented by NXP are listed and outlined in the table below.

These clusters are detailed in ‘Part III: General Clusters’ of this manual.

Cluster Cluster ID Description
Basic 0x0000 The Basic cluster contains the basic properties of a
ZigBee device (e.g. software and hardware versions)
and allows the setting of user-defined properties (such
as location). This cluster is detailed in Chapter 8.
Power Configuration 0x0001 The Power Configuration cluster allows the details of a
device’s power source(s) to be determined and under/
over-voltage alarms to be configured. This cluster is
detailed in Chapter 9.
Device Temperature Configuration 0x0002 The Device Temperature Configuration cluster allows
information about the internal temperature of a device
to be obtained and under/over-temperature alarms to
be configured. This cluster is detailed in Chapter 10.
Identify 0x0003 The Identify cluster allows a ZigBee device to make
itself known visually (e.g. by flashing a light) to an
observer, such as a network installer. This cluster is
detailed in Chapter 11.
Groups 0x0004 The Groups cluster allows the management of the
Group table concerned with group addressing - that is,
the targeting of multiple endpoints using a single
address. This cluster is detailed in Chapter 12.
Scenes 0x0005 The Scenes cluster allows the management of pre-
defined sets of cluster attribute values called scenes,
where a scene can be stored, retrieved and applied to
put the system into a pre-determined state. This clus-
ter is detailed in Chapter 13.
On/Off 0x0006 The On/Off cluster allows a device to be put into the
‘on’ and ‘off’ states, or toggled between the two states.
This cluster is detailed in Chapter 14.
On/Off Switch Configuration 0x0007 The On/Off Switch Configuration cluster allows the
switch type on a device to be defined, as well as the
commands to be generated when the switch is moved
between its two states. This cluster is detailed in
Chapter 15.
Level Control 0x0008 The Level Control cluster allows control of the level of
a physical quantity (e.g. heat output) on a device. This
cluster is detailed in Chapter 16.
Alarms 0x0009 The Alarms cluster is used for sending alarm notifica-
tions and the general configuration of alarms for all
other clusters on the ZigBee device (individual alarm
conditions are set in the corresponding clusters). Thi s
cluster is detailed in Chapter 17.
Cluster Cluster ID Description
Time 0x000A The Time cluster provides an interface to a real-time
clock on a ZigBee device, allowing the clock time to be
read and written in order to synchronise the clock to a
time standard - the number of seconds since 0 hrs 0
mins 0 secs on 1st January 2000 UTC (Co-ordinated
Universal Time). This cluster includes functionality for
local time-zone and daylight saving time. This cluster
is detailed in Chapter 18.
Analogue Input (Basic) 0x000C The Analogue Input (Basic) cluster provides an inter-
face for accessing an analogue measurement. This
cluster is detailed in Section 19.1.
Analogue Output (Basic) 0x000D The Analogue Output (Basic) cluster provides an
interface for setting the value of an analogue output.
This cluster is detailed in Section 19.2.
Binary Input (Basic) 0x000F The Binary Input (Basic) cluster provides an interface
for accessing a binary (two-state) measurement. This
cluster is detailed in Section 19.3.
Binary Output (Basic) 0x0010 The Binary Output (Basic) cluster provides an inter-
face for setting the state of a binary (two-state) output.
This cluster is detailed in Section 19.4.
Multistate Input (Basic) 0x0012 The Multistate Input (Basic) cluster provides an inter-
face for accessing a multistate measurement (that can
take one of a set of fixed states). This cluster is
detailed in Section 19.5.
Multistate Output (Basic) 0x0013 The Multistate Output (Basic) cluster provides an
interface for setting the value of a multistate output
(that can take one of a set of fixed states). This cluster
is detailed in Section 19.6.
Poll Control 0x0020 The Poll Control cluster provides an interface for
remotely controlling the rate at which a ZigBee End
Device polls its parent for data. This cluster is detailed
in Chapter 20.
Power Profile 0x001A The Power Profile cluster provides an interface
between a home appliance (e.g. a washing machine)
and the controller of an energy management system.
This cluster is detailed in Chapter 21.
Diagnostics 0x0B05 The Diagnostics cluster allows the operation of the
ZigBee PRO stack to be followed over time. This clus-
ter is detailed in Chapter 22.

1.1.2 Measurement and Sensing

The Measurement and Sensing clusters implemented by NXP are listed and outlined in the table below. These clusters are detailed in ‘Part IV: Measurement and Sensing Clusters’ of this manual.

Cluster Cluster ID Description
Illuminance Measurement 0x0400 The Illuminance Measurement cluster provides an
interface to an illuminance measuring device, allowing
the configuration of measuring and the reporting of
measurements. This cluster is detailed in Chapter 23.
Illuminance Level Sensing 0x0401 The Illuminance Level Sensing cluster provides an
interface to light-level sensing functionality. This clus-
ter is detailed in Chapter 24.
Temperature Measurement 0x0402 The Temperature Measurement cluster provides an
interface to a temperature measuring device, allowing
the configuration of measuring and the reporting of
measurements. This cluster is detailed in Chapter 25.
Pressure Measurement 0x0403 The Pressure Measurement cluster provides an inter-
face to a pressure measuring device, allowing the
configuration of measuring and the reporting of meas-
urements. This cluster is detailed in Chapter 26.
Flow Measurement 0x0404 The Flow Measurement cluster provides an interface
to a flow measuring device for a fluid, allowing the
configuration of measuring and the reporting of meas-
urements. This cluster is detailed in Chapter 27.
Relative Humidity Measurement 0x0405 The Relative Humidity Measurement cluster provides
an interface to a humidity measuring device, allowing
the configuration of relative humidity measuring and
the reporting of measurements. This cluster is detailed
in Chapter 28.
Occupancy Sensing 0x0406 The Occupancy Sensing cluster provides an interface
to an occupancy sensor, allowing the configuration of
sensing and the reporting of status. This cluster is
detailed in Chapter 29.
Electrical Measurement 0x0B04 The Electrical Measurement cluster provides an inter-
face for obtaining electrical measurements from a
device. This cluster is detailed in Chapter 30.

1.1.3 Lighting

The Lighting clusters implemented by NXP are listed and outlined in the table below.

These clusters are detailed in ‘Part V: Lighting Clusters’ of this manual.

Cluster Cluster ID Description
Colour Control 0x0300 The Colour Control cluster can be used to adjust the
colour of a light (it does not govern the overall lumi-
nance of the light, as this is controlled using the Level
Control cluster). This cluster is detailed in Chapter 31.
Ballast Configuration 0x0301 The Ballast Configuration cluster can be used to con-
figure a lighting ballast that restricts the light levels of
a connected set of lamps. This cluster is detailed in
Chapter 32.

1.1.4 Heating, Ventilation and Air-Conditioning (HVAC)

The HVAC clusters implemented by NXP are listed and outlined in the table below.

These clusters are detailed in ‘Part VI: HVAC Clusters’ of this manual.

Cluster Cluster ID Description
Thermostat 0x0201 The Thermostat cluster provides a means of configur-
ing and controlling the functionality of a thermostat.
This cluster is detailed in Chapter 33.
Fan Control 0x0202 The Fan Control cluster provides a means of con-
trolling the speed or state of a fan which may be part
of a heating or cooling system. The cluster is detailed
in Chapter 34.
Thermostat User Interface Configuration 0x0204 The Thermostat User Interface (UI) Configuration
cluster provides a means of configuring the user inter-
face (keypad and/or LCD screen) for a thermostat or a
thermostat controller device. This cluster is detailed in
Chapter 35.

1.1.5 Closures

The Closure clusters implemented by NXP are listed and outlined in the table below.

These clusters are detailed in ‘Part VII: Closure Clusters’ of this manual.

Cluster Cluster ID Description
Door Lock 0x0101 The Door Lock cluster provides a means of represent-
ing the state of a door lock and (optionally) the door.
This cluster is detailed in Chapter 36.

1.1.6 Security and Safety

The Security and Safety clusters implemented by NXP are listed and outlined in the table below. These clusters are detailed in ‘Part VIII: Security and Safety Clusters’ of this manual.

Cluster Cluster ID Description
IAS Zone 0x0500 The IAS Zone cluster provides an interface to a zone
device in an IAS (Intruder Alarm System). This cluster
is detailed in Chapter 37.
IAS ACE (Ancillary Control Equipment) 0x0501 The IAS ACE cluster provides a control interface to a
CIE (Control and Indicating Equipment) device in an
IAS (Intruder Alarm System). This cluster is detailed in
Chapter 38.
IAS WD (Warning Device) 0x0502 The IAS WD cluster provides an interface to a Warn-
ing Device in an IAS (Intruder Alarm System). For
example, a CIE (Control and Indicating Equipment)
device can use the cluster to issue alarm warning indi-
cations to a Warning Device when an alarm condition
is detected. This cluster is detailed in Chapter 39.

1.1.7 Smart Energy

The Smart Energy clusters implemented by NXP are listed and outlined in the table below. These clusters are detailed in ‘Part IX: Smart Energy Clusters’ of this manual.

Cluster Cluster ID Description
Price 0x0700 The Price cluster provides the mechanism for sending
and receiving pricing information within a ZigBee 3.0
network. This cluster is detailed in Chapter 40.
Demand-Response and Load Control 0x0701 The Demand-Response and Load Control (DRLC)
cluster provides an interface for controlling an
attached appliance that supports load control. The
cluster is able to receive load control requests and act
upon them - the demand-response functionality. This
cluster is detailed in Chapter 41.
Simple Metering 0x0702 The Simple Metering cluster provides a mechanism to
obtain consumption data from a metering device (elec-
tric, gas, water or thermal). This cluster is detailed in
Chapter 42.

1.1.8 Commissioning

The Commissioning clusters implemented by NXP are listed and outlined in the table below. These clusters are detailed in ‘Part X: Commissioning Clusters’ of this manual.

Cluster Cluster ID Description
Commissioning 0x0015 The Commissioning cluster can be used for commis-
sioning the ZigBee stack on a device during network
installation and defining the device behaviour with
respect to the ZigBee network (it does not affect appli-
cations operating on the devices). This cluster is
detailed in Chapter 43.
Touchlink Commissioning 0x1000 The Touchlink Commissioning cluster is used when
forming a ZigBee 3.0 network or adding a new node to
an existing network. This cluster is detailed in Chapter
44.

1.1.9 Appliances

The Appliances clusters implemented by NXP are listed and outlined in the table below. These clusters are detailed in ‘Part XI: Appliances Clusters’ of this manual.

Cluster Cluster ID Description
Appliance Control 0x001B The Appliance Control cluster provides an interface
for remotely controlling appliances in the home. This
cluster is detailed in Chapter 45.
Appliance Identification 0x0B00 The Appliance Identification cluster provides an inter-
face for obtaining and setting basic appliance informa-
tion. This cluster is detailed in Chapter 46.
Appliance Events and Alerts 0x0B02 The Appliance Events and Alerts cluster provides an
interface for the notification of significant events and
alert situations. This cluster is detailed in Chapter 47.
Appliance Statistics 0x0B03 The Appliance Statistics cluster provides an interface
for supplying statistical information about an appli-
ance. This cluster is detailed in Chapter 48.

1.1.10 Over-The-Air (OTA) Upgrade

The Over-The-Air (OTA) Upgrade cluster is outlined in the table below and detailed in ‘Part XII: Over-The-Air Upgrade’ of this manual.

Cluster Cluster ID Description
OTA Upgrade 0x0019 The OTA Upgrade cluster provides the facility to
upgrade (or downgrade or re-install) application soft-
ware on the nodes of a ZigBee 3.0 network by distrib-
uting the replacement software through the network
(over the air) and updating the software with minimal
interruption to node operation. This cluster is detailed
in Chapter 49.

could i get a link to that site?