Aeotec MultiSensor 7 Set Value

Hi,

I have a couple of MS7’s that occasionally get stuck on motion detected. I’m trying to use the set value command to clear the motion detection, but I can’t get it to work.

I pulled the logs and found this:

    "25-113-0-Home Security-Motion sensor status": {
      "endpoint": 0,
      "commandClass": 113,
      "commandClassName": "Notification",
      "property": "Home Security",
      "propertyKey": "Motion sensor status",
      "propertyName": "Home Security",
      "propertyKeyName": "Motion sensor status",
      "ccVersion": 8,
      "metadata": {
        "type": "number",
        "readable": true,
        "writeable": false,
        "label": "Motion sensor status",
        "ccSpecific": {
          "notificationType": 7
        },
        "min": 0,
        "max": 255,
        "states": {
          "0": "idle",
          "8": "Motion detection"
        },
        "stateful": true,
        "secret": false
      },
      "value": 0

I’ve tried different variations of the set value command, but can’t get it to work:

service: zwave_js.set_value
data:
  endpoint: "0"
  value: 0
  command_class: "113"
  property_key: "Motion sensor status"
  property: "Home Security"
target:
  entity_id: binary_sensor.kitchen_sensor_motion_detection

It’s been my experience that the device isn’t the issue with hung motion state, but the software. Likely caused by missed updates from Z-wave. At that point the device and the software are out of sync. You would be better off changing the entity state in Developer Tools to restore the sync.

Note that this is a symptom of a Z-wave communications problem. If you use Z-wave-JS-UI I would suggest checking the Z-wave device health.

I can’t change the entity state as it’s a binary sensor. I found a python script that can change the state of a binary sensor, but it doesn’t actually work as even when I force it to the same state, it doesn’t actually match the state that is set by Z-Wave JS.

If you select device as your trigger then select your sensor from the device list you should see an option called press yourdevicename idle motion sensor.

Found it! I’ll have to wait until I get home to test it Does this command succesfully clear motion detected?

image

Developer tools can change the state of any entity AFAIK. I just changed my Entrance Motion from off to on and back to off without issue. Note that I’m not saying the device is changing state, just the entity.

That also works for me @mterry63 Can that be automated? Or is it only a manual action?

I finally figured it out with the python script. You have to set the state in lower case (on or off) then it works. If you use capitals (ON or OFF), then it doesn’t work.

#==================================================================================================
#  python_scripts/set_state.py 
#==================================================================================================

#--------------------------------------------------------------------------------------------------
# Set the state or other attributes for the entity specified in the Automation Action
#--------------------------------------------------------------------------------------------------

inputEntity = data.get('entity_id')
if inputEntity is None:
    logger.warning("===== entity_id is required if you want to set something.")
else:    
    inputStateObject = hass.states.get(inputEntity)
    inputState = inputStateObject.state
    inputAttributesObject = inputStateObject.attributes.copy()

    for item in data:
        newAttribute = data.get(item)
        logger.debug("===== item = {0}; value = {1}".format(item,newAttribute))
        if item == 'entity_id':
            continue            # already handled
        elif item == 'state':
            inputState = newAttribute
        else:
            inputAttributesObject[item] = newAttribute
        
    hass.states.set(inputEntity, inputState, inputAttributesObject)

Developer tools is a manual action, but as you’ve found the python script can be automated. As I said earlier, I would treat this as a short-term band aid and work to fix the underlying problem by addressing the Z-wave communications issue that causes this.

You should use the Idle button. It clears the state in the Z-wave driver.

1 Like

@mterry63, it’s a hardware issue. I’ve been in contact with support and they admitted they have issues with the motion detection sticking on.

2 Likes