Aqara Presence Sensor FP2 gives error

Posted on
Sun Mar 03, 2024 9:29 am
CliveS offline
Posts: 771
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Aqara Presence Sensor FP2 gives error

I have an Aqara FP2 Presence sensor which I used to import into indigo from HomeKit as a variable but since I now have Home Assistant running natively on my 2014
MacBook I decided to try Home Assistant Agent.

This works great as the Presence and Lux values are correct but the GUI state shows ‘off’ and I get an error each time the lux changes

Code: Select all
  Error                           device "Aqara FP2 Lux Sensor Via Home Assistant" state key sensorValue not defined (ignoring update request)

I have modified the code to ignore the error but I would need to change it every time you update the plugin.

The diagnostics from HA for this device shows.



And the Indigo Lux and Presence device details
Code: Select all
  Script                          address : binary_sensor.presence_sensor_fp2_689f_presence_sensor_1
allowOnStateChange : False
allowSensorValueChange : False
batteryLevel : None
buttonGroupCount : 0
configured : True
description :
deviceTypeId : HAbinarySensorType
displayStateId : onOffState
displayStateImageSel : MotionSensorTripped
displayStateValRaw : True
displayStateValUi : on
enabled : True
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState :
folderId : 603788583
globalProps : MetaProps : (dict)
     no.homeassistant.plugin : (dict)
          SupportsOnState : true (bool)
          SupportsSensorValue : false (bool)
          SupportsStatusRequest : false (bool)
          address : binary_sensor.presence_sensor_fp2_689f_presence_sensor_1 (string)
          states_list : (list)
               Item : device_class (string)
               Item : friendly_name (string)
id : 408117572
lastChanged : 2024-03-03 15:00:11
lastSuccessfulComm : 2024-03-03 15:00:11
model : Home Assistant Binary Sensor
name : Aqara FP2 Presence Sensor Via Home Assistant
onState : True
ownerProps : no.homeassistant.plugin : (dict)
     SupportsOnState : true (bool)
     SupportsSensorValue : false (bool)
     SupportsStatusRequest : false (bool)
     address : binary_sensor.presence_sensor_fp2_689f_presence_sensor_1 (string)
     states_list : (list)
          Item : device_class (string)
          Item : friendly_name (string)
pluginId : no.homeassistant.plugin
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
sensorValue : None
sharedProps : com.indigodomo.indigoserver : (dict)
states : States : (dict)
     actual_state : on (string)
     device_class : occupancy (string)
     friendly_name : Living Room FP2 Presence (string)
     lastUpdated : 2024-03-03T15:00:11.380432+00:00 (string)
     onOffState : on (on/off bool)
subModel :
subType :
supportsAllLightsOnOff : False
supportsAllOff : False
supportsOnState : True
supportsSensorValue : False
supportsStatusRequest : False
version : None

3 Mar 2024 at 15:13:38
   Script                          address : sensor.presence_sensor_fp2_689f_light_sensor_light_level
allowOnStateChange : False
allowSensorValueChange : False
batteryLevel : None
buttonGroupCount : 0
configured : True
description :
deviceTypeId : HAsensor
displayStateId : onOffState
displayStateImageSel : NoImage
displayStateValRaw : False
displayStateValUi : off
enabled : True
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState :
folderId : 603788583
globalProps : MetaProps : (dict)
     no.homeassistant.plugin : (dict)
          SupportsOnState : true (bool)
          SupportsSensorValue : false (bool)
          SupportsStatusRequest : false (bool)
          address : sensor.presence_sensor_fp2_689f_light_sensor_light_level (string)
          states_list : (list)
               Item : state_class (string)
               Item : unit_of_measurement (string)
               Item : device_class (string)
               Item : friendly_name (string)
id : 70681190
lastChanged : 2024-03-03 15:07:49
lastSuccessfulComm : 2024-03-03 15:07:49
model : Home Assistant Value Sensor
name : Aqara FP2 Lux Sensor Via Home Assistant
onState : False
ownerProps : no.homeassistant.plugin : (dict)
     SupportsOnState : true (bool)
     SupportsSensorValue : false (bool)
     SupportsStatusRequest : false (bool)
     address : sensor.presence_sensor_fp2_689f_light_sensor_light_level (string)
     states_list : (list)
          Item : state_class (string)
          Item : unit_of_measurement (string)
          Item : device_class (string)
          Item : friendly_name (string)
pluginId : no.homeassistant.plugin
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
sensorValue : None
sharedProps : com.indigodomo.indigoserver : (dict)
states : States : (dict)
     actual_state : 29 (string)
     device_class : illuminance (string)
     friendly_name : Living Room FP2 Lux (string)
     lastUpdated : 2024-03-03T15:07:49.442662+00:00 (string)
     onOffState : off (on/off bool)
     state_class : measurement (string)
     unit_of_measurement : lx (string)
subModel :
subType :
supportsAllLightsOnOff : False
supportsAllOff : False
supportsOnState : True
supportsSensorValue : False
supportsStatusRequest : False
version : None

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Tue Mar 05, 2024 11:26 am
anyone offline
User avatar
Posts: 125
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: Aqara Presence Sensor FP2 gives error

Try configuring the light sensor as a Home Assistant Value Sensor.

I've set mine up this way. The GUI accurately displays the lux value, and no errors are logged when the lux changes.

Posted on
Tue Mar 05, 2024 12:48 pm
CliveS offline
Posts: 771
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Aqara Presence Sensor FP2 gives error

anyone wrote:
Try configuring the light sensor as a Home Assistant Value Sensor.

I've set mine up this way. The GUI accurately displays the lux value, and no errors are logged when the lux changes.


I have set it up like this


Screenshot 2024-03-05 at 18.37.48.png
Screenshot 2024-03-05 at 18.37.48.png (219.17 KiB) Viewed 545 times


but still get the error unless I modify the plugin to ignore 'illumination'

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Tue Mar 05, 2024 5:51 pm
anyone offline
User avatar
Posts: 125
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: Aqara Presence Sensor FP2 gives error

Try deleting the device named "HA Living Room FP2 Lux Sensor" and then recreate it as a "Home Assistant Value Sensor".

I believe I have replicated the same errors you're encountering by not creating the Light sensor directly. Instead, I modified an existing Binary Sensor, changing it to a Value Sensor, and updated the Entity to the light sensor. That lead to the issue.

Code: Select all
 Error                           device "Carriage House LIght Sensor Testing" state key sensorValue not defined (ignoring update request)
Attachments
lux_sensor_issue.png
My FP2 lux sensor
lux_sensor_issue.png (422.61 KiB) Viewed 520 times
lux_sensor_issue_also.png
lux_sensor_issue_also.png (465.47 KiB) Viewed 520 times

Posted on
Tue Mar 05, 2024 7:19 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Presence Sensor FP2 gives error

I've run into this before. Changing the type of an existing device doesn't always work right. Probably something I'm doing wrong in my code.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Mar 06, 2024 9:32 am
CliveS offline
Posts: 771
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Aqara Presence Sensor FP2 gives error

anyone wrote:
Try deleting the device named "HA Living Room FP2 Lux Sensor" and then recreate it as a "Home Assistant Value Sensor".

I believe I have replicated the same errors you're encountering by not creating the Light sensor directly. Instead, I modified an existing Binary Sensor, changing it to a Value Sensor, and updated the Entity to the light sensor. That lead to the issue.

Thank you for digging into this so much, that was the answer and it is now showing '9lx' instead of 'off',
I suppose I was making a Frankenstein device, with the 'states' being correct but the GUI State was getting the current occupancy of off or on.
So much better having a 'device' compared to the shortcuts method giving 'variables'.
Until (if) Aqara update it to Matter I have now used Glenn's HK plugin to get the values back into the Home app, long way round but works perfectly.

Once again, Thanks
Last edited by CliveS on Wed Mar 06, 2024 11:40 am, edited 1 time in total.

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Wed Mar 06, 2024 9:40 am
CliveS offline
Posts: 771
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Aqara Presence Sensor FP2 gives error

FlyingDiver wrote:
I've run into this before. Changing the type of an existing device doesn't always work right. Probably something I'm doing wrong in my code.


Joe, the code works fine, it's definitely me not thinking it through is the problem.
And as I write this the lights turn on as the light level gets below the threshold thanks to the plugin!
Thanks.

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Fri Mar 08, 2024 5:55 pm
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: Aqara Presence Sensor FP2 gives error

Just wanted to say thanks for posting about this - I installed the Aqara FP2 Presence sensor and it works like magic, so much better than anything else I have tried.

It solved a 7 year problem I had with the lights turning off in my laundry room if I was standing at the sink washing something - every other sensor would not detect with out any motion — this one works perfect and the zone control is like something from the future.

In case anyone else wants to try one, the process is

1. Install the Aqara app
2. Power up the Aqara FP2 Presence sensor and add it to the Aqara application
3. Find the Aqara FP2 Presence sensor in your apple home application
4. Delete Aqara FP2 Presence sensor from the apple home application (this makes it visible for Home Assistant to see)
5. Verify it is in your Home Assistant
6. Add it to Home Assistant Agent (note — add the Aqara Presence sensor and luminance sensor as separate devices in Indigo)

Let me know if I missed anything…

_______
Norm

Posted on
Fri Mar 15, 2024 1:21 pm
anyone offline
User avatar
Posts: 125
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: Aqara Presence Sensor FP2 gives error

norcoscia wrote:
Let me know if I missed anything…


Here's a concise guide on setting up the Aqara FP2 Presence Sensor with Home Assistant.
https://www.derekseaman.com/2023/04/home-assistant-setting-up-the-aqara-fp2-presence-sensor.html

Also check out FlyingDiver's Occupatum Plugin, which integrates well with FP2 sensors allowing you to add delays for occupancy/presence based triggers.

Posted on
Sat Mar 16, 2024 5:01 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: Aqara Presence Sensor FP2 gives error

Thanks!!!

_______
Norm

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests