# Aqara sensors stopped working?

**URL:** <https://community.homey.app/t/aqara-sensors-stopped-working/45794>\
**Category:** Devices\
**Tags:** zigbee\
**Created:** [April 5, 2021, 5:12pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794 "2021-04-05T17:12:05Z")\
**Posts on this page:** 20\
**Page:** 7

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 17, 2022, 11:22pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/122 "2022-07-17T23:22:54Z")

</div>

It’s odd isn’t it, Joka…

Here’s the code I used.  
This is your code copy/pasted:

 ![Screenshot from 2022-07-18 01-05-51](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/4/a4ebac2a03b87a986c6d9cea65076b9f08e02558.png)  
Replacing it with `alarm_motion` results in the same error msg  
.  
Here I replaced `alarm_contact` with `measure_battery`:  
 ![Screenshot from 2022-07-18 01-07-02](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/6/f62d5c095ce25e9b0e360a054090b7dbbacfb258.png)

.  
The code with `alarm_contact` again, but now without `substring(0,10)`

 ![Screenshot from 2022-07-18 01-10-35](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/f/df5aa896e4f0d2b95afda7eb65450725b964d429.png)

.  
Is it a version thing?  
Homeyscript v3.4.1  
Homey v8.0.3-rc-7

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [July 18, 2022, 4:31am UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/123 "2022-07-18T04:31:37Z")

</div>

There’s probably _one_ sensor that doesn’t have the `lastUpdated` property.

This might work better:

```auto
array.push( device.capabilitiesObj.alarm_contact.lastUpdated?.substring(0, 10) + ' ' + device.name);

```

It will only call `substring()` if `lastUpdated` is defined.

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [July 18, 2022, 6:40am UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/124 "2022-07-18T06:40:01Z")

</div>

That’s an option and good idea. I assumed that every alarm\_contact has a `lastUpdated` property. Maybe a Virtual Device? With VD I was able to generate an alarm\_contact without a `lastUpdated` property.

But anyway @Peter_Kawa you should be able to identify the device with:

```auto
const devices = await Homey.devices.getDevices({ filter: {class: 'sensor', capabilities: 'alarm_contact'} });
_.forEach(devices, device => {
if (!device.capabilitiesObj.alarm_contact.lastUpdated) log(device);
});

```

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 18, 2022, 5:31pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/125 "2022-07-18T17:31:47Z")

</div>

That did the trick, Robert! Thx!  
@Joka There is a v motion sensor indeed, which returns “undefined”. So that problem’s solved.  
But I can’t find an issue with the contact sensors.

Script with ` ?.substring(0,10)`:

 ![Screenshot_20220718-145243_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/5/e5d28b83e5592a0c809b72ec91c9cde84719eaef.jpeg)

Script without ` ?.substring(0,10)`:

 ![Screenshot_20220718-145325_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/2/a2667c1399376f877269a09e54fb00410aa4665d.jpeg)

I have to mention “Deur/Raam” is a \< group \> app device, with all contact sensors in it.

.

> [@Joka](#):
>
> ```auto
> const devices = await Homey.devices.getDevices({ filter: {class: 'sensor', capabilities: 'alarm_contact'} });
> _.forEach(devices, device => {
> if (!device.capabilitiesObj.alarm_contact.lastUpdated) log(device);
> });
> 
> ```

This returns nothing…

Thanks in advance guys.

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [July 19, 2022, 6:27am UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/126 "2022-07-19T06:27:18Z")

</div>

Deur/Raam seems not the problem its date is trimed with substring. Please let me see the error message of the alarm\_contact sensors again.

Are all of your alarm\_contact sensors in the list? If you want you can send me the result of the following as PM:

```auto
const devices = await Homey.devices.getDevices({ filter: {class: 'sensor', capabilities: 'alarm_contact'} });
_.forEach(devices, device => {
log(device);
});

```

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 19, 2022, 12:58pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/127 "2022-07-19T12:58:37Z")

</div>

> [@Joka](#):
>
> Please let me see the error message of the alarm\_contact sensors again.

This is the previous posted error message.

> [@Peter\_Kawa](#):
>
> ![Screenshot from 2022-07-18 01-05-51](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/4/a4ebac2a03b87a986c6d9cea65076b9f08e02558.png)

But (I can’t stand this) atm, it returns all of my 5 contact sensors without errors 🤨

> [@Joka](#):
>
> Are all of your alarm\_contact sensors in the list?

Yup

> [@Joka](#):
>
> If you want you can send me the result of the following as PM:

Will do, thanks i.a.  
There’s no error anymore, but it might reveal something to you.  
In the returned data, I counted all of my 4 sensors (lastUpdated alarm\_contact, alarm\_battery, measure\_battery) and the group sensor device, which has only lastUpdated alarm\_contact.

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [July 19, 2022, 2:01pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/128 "2022-07-19T14:01:24Z")

</div>

So, no error with the alarm\_contact anymore if I understand you right.

The only reason I can imagine is that your Virtual Device (alarm\_motion) which you fixed included also the capability alarm\_contact. In this case the alarm\_contact doesn’t included the lastUpdated property. This would result in the error.

Example of a VD with both capabilities:

> \_\_athom\_api\_type: ‘HomeyAPI.ManagerDevices.Device’,  
> id: ‘xxxxx’,  
> name: ‘New Device’,  
> driverUri: ‘homey:app:com.arjankranenburg.virtual’,  
> driverId: ‘virtual\_switch’,  
> zone: ‘xxxx’,  
> zoneName: ‘Zuhause’,  
> icon: ‘window\_open.svg’,  
> iconObj: {  
> id: ‘xxxx’,  
> url: ‘/icon/xxxx/icon.svg’  
> },  
> settings: { energy\_value\_constant: null },  
> settingsObj: true,  
> class: ‘sensor’,  
> energyObj: { W: null, batteries: null, cumulative: null, generator: null },  
> capabilities: [‘alarm\_contact’, ‘alarm\_motion’],  
> capabilitiesObj: {  
> alarm\_contact: {  
> value: null,  
> type: ‘boolean’,  
> getable: true,  
> setable: false,  
> title: ‘Contact alarm’,  
> desc: ‘Contact sensor, e.g. for windows (true/false)’,  
> units: null,  
> id: ‘alarm\_contact’,  
> options: {},  
> values: undefined  
> },  
> alarm\_motion: {  
> value: null,  
> type: ‘boolean’,  
> getable: true,  
> setable: false,  
> title: ‘Motion alarm’,  
> desc: null,  
> units: null,  
> id: ‘alarm\_motion’,  
> options: {},  
> values: undefined  
> }  
> },

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 19, 2022, 10:51pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/129 "2022-07-19T22:51:31Z")

</div>

> [@Joka](#):
>
> So, no error with the alarm\_contact anymore if I understand you right.

Correct. It boggled me why it suddenly worked OK.  
Finally it came to mind.  
Because of the virtual motion sensor issue, I removed that.  
AND appearantly a virtual contact sensor as well; _totally forgot about that_.

So I restored a backup, to have the virtual sensors back, and the setting. Now the script returned the faulty virtual contact sensor. It’s `lastUpdate` value is `null` (while I never set a state through a flow), just like the virtual motion sensor.  
Returned data snippet:

```auto
capabilities: ['alarm_contact'],
  capabilitiesObj: {
    alarm_contact: {
      value: null,
      type: 'boolean',
      getable: true,
      setable: false,
      title: 'Contact alarm',
      desc: 'Contact sensor, e.g. for windows (true/false)',

```

---

<div class="post-metadata">

**Author:** ![aandersen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/aandersen/32/44483_2.png) [@aandersen](https://community.homey.app/u/aandersen)\
**Post date:** [July 23, 2022, 2:21pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/130 "2022-07-23T14:21:08Z")

</div>

I’m also having trouble with Aqara sensors that stop reporting after a while. This seems like a common issue, sadly - but as far as I understand it, the issue does not occur with Deconz, so sounds like it’s a Homey issue. Has anyone from Homey actually looked into this?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 23, 2022, 4:25pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/131 "2022-07-23T16:25:33Z")

</div>

Well I didn’t have any trouble with 12 Aqara sensors (temp/contact/motion), until I added Ikea lights.  
But, after adding a Tuya Zigbee app and end-device, zigbee is rock-solid (a pure coincidental discovery).  
Athom has no Aqara app, and will point at the Aqara app developer I’m afraid.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [July 27, 2022, 8:15am UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/132 "2022-07-27T08:15:06Z")

</div>

I’m facing this Aqara issue only for some of my sensors.  
I’ve seen in developer ZigBee map, that sensors with this issue are routed via INNR SP220 plugs. and these plugs had vvery bad routes (2x throught the whole house over 3 levels). I replaced one of the plugs wich covers the garden area with an old Osram plug. For some days I have a stable connection to the temperature sensor outside.  
I can’t remember when this issue started. But I replaced some Osram plugs with INNR (some SP120, some SP220 since 120 is not available anymore. Perhaps this is related. Because only sensors far away which are routet over such INNR pugs are affected.

---

<div class="post-metadata">

**Author:** ![KjetilK](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetilk/32/49033_2.png) [@KjetilK](https://community.homey.app/u/KjetilK)\
**Post date:** [July 27, 2022, 9:54am UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/133 "2022-07-27T09:54:06Z")

</div>

The distance from Homey do indeed seem to play a part. I had two sensors with around 3 meter distance difference. One working flawlessly and the other one stopping to work after some days.

---

<div class="post-metadata">

**Author:** ![RogerSt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rogerst/32/12432_2.png) [@RogerSt](https://community.homey.app/u/RogerSt)\
**Post date:** [July 28, 2022, 6:56pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/134 "2022-07-28T18:56:12Z")

</div>

Happy with my switch to Fibaro multisensor and sensative guard strips, both z-wave.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 4, 2022, 7:35am UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/135 "2022-08-04T07:35:56Z")

</div>

A short reply with my experiences…  
I removed the innr SP220 plugs and placed them into the Hue mesh. The SP120 from from Hue I moved into the Homey mesh.  
Only the innr SP120 and some Osram plugs are used now as repeater.  
While checking the Zigbee developer page I saw some devices with white question marks in the routing list. I can’t say if this occoured with the imported backup on another Homey. These devices were still working but I reincluded them to prevent problems with a corrupted mesh. After this reorganisation was done, all is working fine now. No Aqaras stopped working yet.  
I can’t remember if the problems with Aqara started exactly with the new innr plugs. But I hope it’s solved now.

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [August 6, 2022, 8:11pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/136 "2022-08-06T20:11:14Z")

</div>

> [@RonnyW](#):
>
> While checking the Zigbee developer page I saw some devices with white question marks in the routing list

I had similar experience, also re-added them without removal just to prevent issues even they were responsive (and despite the fact I have been reassured it’s OK by Athom support, I simply think it’s not 😉 ). Last time it happened like 6 months ago and since then, knocking on the wood, it’s stable.

---

<div class="post-metadata">

**Author:** ![Nymalt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nymalt/32/29792_2.png) [@Nymalt](https://community.homey.app/u/Nymalt)\
**Post date:** [August 15, 2022, 1:33pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/137 "2022-08-15T13:33:11Z")

</div>

I’m happy to see my initial question has brought up alot of other users of the Aqara sensors with same issue. However saddens me that there is no solution to fix this and nor Aqara or Homey can assist in a solution that helps us all.

What other sensors would you guys suggest instead of Aqara? As of now I see no reason to continue banging my head against a wall, having to reconfigure the sensors at various occations when they stop working ☹ (though at reasonable price AND stable - both temperature and motion).

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [August 15, 2022, 1:36pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/138 "2022-08-15T13:36:18Z")

</div>

> [@Nymalt](#):
>
> there is no solution to fix this and nor Aqara or Homey can assist in a solution

Aqara don’t mix with certain brands/specific models, f.i. Ikea filament lights, and some _specific_ Osram plugs afaik.  
It works fine with Ikea sockets.

Well, this is my workaround and it works for me:

> [@Aqara sensors stopped working?](https://community.homey.app/t/aqara-sensors-stopped-working/45794/131):
>
> Well I didn’t have any trouble with 12 Aqara sensors (temp/contact/motion), until I added Ikea lights. But, after adding a Tuya Zigbee app and end-device, zigbee is rock-solid (a pure coincidental discovery). Athom has no Aqara app, and will point at the Aqara app developer I’m afraid.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 15, 2022, 2:59pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/139 "2022-08-15T14:59:45Z")

</div>

A short statement after removing all innr SP220 plugs:  
Zigbee is fine, no dropped Aqara sensors yet.  
The existing Osram and innr SP120 are working fine as router.

---

<div class="post-metadata">

**Author:** ![Jens\_Lundmark](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jens_lundmark/32/12593_2.png) [@Jens\_Lundmark](https://community.homey.app/u/Jens_Lundmark)\
**Post date:** [August 28, 2022, 5:05pm UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/140 "2022-08-28T17:05:41Z")

</div>

For me it was the Aqara 2 channel relay that did not forward the motion signal. disconnected and reconnected power to it and after restart both motion sensors that was not working started working, and both these had the 2 channel relay as a route (see route for sensor not working in [Homey Developer Tools](https://tools.developer.homey.app/tools/zigbee) ). other aqara motion sensors have been working correctly but not these two.

---

<div class="post-metadata">

**Author:** ![Joost\_Scholten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/joost_scholten/32/55879_2.png) [@Joost\_Scholten](https://community.homey.app/u/Joost_Scholten)\
**Post date:** [November 1, 2022, 11:43am UTC](https://community.homey.app/t/aqara-sensors-stopped-working/45794/141 "2022-11-01T11:43:50Z")

</div>

Just added a new Aqara motion sensor to Homey. funny thing: LUX keeps getting updated at change, but the activity not. you’d expect there to be either “full” communication or none at all right?

Small coincidence that the sensor is linked via an IKEA filament lamp… 😒  
will see what happens when I add it from another room.

[Previous page](https://community.homey.app/t/aqara-sensors-stopped-working/45794.md?page=6)

[Next page](https://community.homey.app/t/aqara-sensors-stopped-working/45794.md?page=8)
