Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] FGMS001 motion detection does not update MQTT sensor state (48-0-Any) #104

Closed
1 of 3 tasks
katiuskt opened this issue Dec 21, 2020 · 19 comments
Closed
1 of 3 tasks
Assignees
Labels
help wanted Extra attention is needed MQTT discovery MQTT discovery related

Comments

@katiuskt
Copy link

katiuskt commented Dec 21, 2020

Version

Build/Run method

  • Docker
  • PKG
  • Manually built (git clone - npm install - npm run build )

zwavejs2mqtt version: I'm not sure how to get this. I'm using zwavejs/zwavejs2mqtt:dev pulled on 21st Dec

Describe the bug
ZwaveJS2MQTT is not updating the motion information (topic 48-0-Any) for the Fibaro FGMS001 motion sensor.

If I understand properly, for this device ZwaveJS2MQTT idenfity a contact device with topic 48-1-0. It should be a binary_sensor with value True if there is motion and False if there is no motion.

Unfortunately, although the sensor detects a motion event (led is on in the physical device; you can also see it in the screenshots below at topics with CC 113), the state of the 48-0-Any topic remains on the state which it intially has when pairing the device.

No motion:
image

Motion:
image

To Reproduce
Steps to reproduce the behavior:
Pair a Fibaro FGMS001 motion sensor
Trigger a motion event
Check your MQTT broker if the value of the 48-0-Any topic is updated.

Expected behavior
Having the topic for this sensor updated in correspondence of the motion events. That way you could have a HASS binary_sensor for presence.

Additional context
This seems to be exactly the same issue reported in OpenZWave/Zwave2Mqtt#621 for the Zwave2MQTT project.
In that project the root cause pointed out towards an issue at OZW implementation. Apparently to OpenZWave/open-zwave#2300
Just in case the comments on it helps here somehow (I don't understand the final conclusion of that case)

@katiuskt katiuskt added the bug Something isn't working label Dec 21, 2020
@katiuskt katiuskt changed the title [bug] FGMS001 motion detection does not update MQTT sensor state (48-1-0) [bug] FGMS001 motion detection does not update MQTT sensor state (48-0-Any) Dec 21, 2020
@varet80
Copy link
Collaborator

varet80 commented Dec 21, 2020

I fae the issue with the same sensor. and sometimes becomes true. and stays true.
Reading debug log of the driver, Notification is the command class they update when motion is detected. and not the binary.

I do not know the reason but seems device is not sending to driver. I use the Notification CC for motion detection.

based on the reply of OZW and my observations from debug log. Device acts as the new specification sais

Fishlando

You should investigate the config options of the device to see if it can be set to send a SENSOR_BINARY (but note - that SENSOR_BINARY is depreciated by the specifications and isn't used on newer devices - So its possible that this device wont support it)

@katiuskt
Copy link
Author

Based on the latest comment at the above mentioned OZW case where this very same behavior was discussed:

If you want the "older" sensor reports... Add your controller to the 4th association group. This group is used for "backwards compatibility". The ZW5 by default uses the newer "notification CC".

I'm not sure if I want the "older sensor reports" but I would like to have a binary_sensor with a boolean behavior for HASS so I think "let's try it".
So, taking a look at the sensor documentation, it seems like you could set some associations for it as mentioned into the OZW case:
image

Unfortunately only the "Tamper" associations are shown as options for configuration into ZwaveJs2MQTT:
image

Is it expected?

@varet80
Copy link
Collaborator

varet80 commented Dec 21, 2020

Based on the latest comment at the above mentioned OZW case where this very same behavior was discussed:

If you want the "older" sensor reports... Add your controller to the 4th association group. This group is used for "backwards compatibility". The ZW5 by default uses the newer "notification CC".

I'm not sure if I want the "older sensor reports" but I would like to have a binary_sensor with a boolean behavior for HASS so I think "let's try it".
So, taking a look at the sensor documentation, it seems like you could set some associations for it as mentioned into the OZW case:
image

Unfortunately only the "Tamper" associations are shown as options for configuration into ZwaveJs2MQTT:
image

Is it expected?

this morning on dev branch we released a patch, which creates the notification entity.
I am also working on introducing human readable payload to HASS which instead of 0/8 shows the state per the Specification of Z-wave

@katiuskt
Copy link
Author

katiuskt commented Dec 21, 2020

this morning on dev branch we released a patch, which creates the notification entity.
I am also working on introducing human readable payload to HASS which instead of 0/8 shows the state per the Specification of Z-wave

Oh, great news! Would that mean a tipical binary_sensor in HASS could be used? Or it means those 0/3/8 values will be reported in a more understandable words ("Tampering, product covering removed", "Motion Detection, unknown location")?

Also, does it means the current contact binary_sensor is useless, right?

@varet80
Copy link
Collaborator

varet80 commented Dec 21, 2020

you can create your own Binary sensor with custom devices. and Zj2m will create this entity.
copy another binary sensor and post it. If you give me a bit of time I can help you on this.

an example would be:

    {
      "type": "binary_sensor",
      "object_id": "Motiont",
      "discovery_payload": {
        "value_template": "{{ value_json.value }}",
        "payload_on": 8,
        "payload_off": 0,
        "device_class": "temperature",
        "state_topic": "67-1-setpoint-1"
      },
      "values": [
        "67-1-setpoint-1"
      ]
    },

this is a sensor, binary supports vlue_on and value_off
you need to fix static point with the full name of 113 class, and values! also attach thsi under the list of the Id of the device --

To answer the other question: yes as you will get on your screen a name, now shows numbers like my screenshot:
Screenshot 2020-12-21 200341

@varet80 varet80 assigned varet80 and unassigned robertsLando Dec 21, 2020
@varet80 varet80 added MQTT discovery MQTT discovery related help wanted Extra attention is needed and removed bug Something isn't working labels Dec 21, 2020
@robertsLando
Copy link
Member

@AlCalzone

@AlCalzone
Copy link
Member

Yes? What?

@robertsLando
Copy link
Member

Unfortunately, although the sensor detects a motion event (led is on in the physical device; you can also see it in the screenshots below at topics with CC 113), the state of the 48-0-Any topic remains on the state which it intially has when pairing the device.

@AlCalzone this remeber me another issue

@katiuskt
Copy link
Author

katiuskt commented Dec 22, 2020

Thank you @billiaz: I'll try to figure it out to create a boolean device. If not, I guess I could create a binary_sensor in HASS with values taking from template of the autodiscovered from ZwaveJ2MQTT.

Regarding the option mentioned in Sensor documentation (and also into the OZW issue) about the posibility to include the sensor into group 4 for backwards compatibility: In OpenHAB (completely different ZWave stack than OZW and ZwaveJS apparently) is possible to do that
image

Is expecting not having those options in ZWaveJS2MQTT?

@robertsLando
Copy link
Member

@katiuskt Did you try to do it from groups tab? There you can manage associations

@AlCalzone
Copy link
Member

AlCalzone commented Dec 22, 2020

That are the associations. You can add the controller node (usually 1) to the node's group.

this remeber me another issue

@robertsLando I still don't follow...

@katiuskt
Copy link
Author

Thank you all

@robertsLando : Thank you, I didn't notice about the "Group" option into the GUI. Still not understanding well how to put the sensor on group 4 (Motion BC) but I'll figure it out.

@billiaz : Thank you for your tip. In first place I wasn't able to create the HASS Device JSON properly in ZwaveJS2MQTT so I created a binary_sensor directly into HASS with templates to map de values (0/8). Finally, I get it and I get the device created directly into ZWaveJS2MQTT:

{
"type": "binary_sensor",
"object_id": "motion",
"discovery_payload": {
"payload_on": 8,
"payload_off": 0,
"value_template": "{{ value_json.value }}",
"device_class": "motion",
"state_topic": "zwavejs/HC/MotionSensor/113/0/Home_Security/Motion_sensor_status",
"json_attributes_topic": "zwavejs/HC/MotionSensor/113/0/Home_Security/Motion_sensor_status",
"device": {
"identifiers": [
"zwavejs2mqtt_0xf77d3d75_node10"
],
"manufacturer": "Fibargroup",
"model": "Motion Sensor (FGMS001)",
"name": "HC-MotionSensor",
"sw_version": "3.2"
},
"name": "HC-MotionSensor_motion",
"unique_id": "zwavejs2mqtt_0xf77d3d75_10-113-0-Home Security-Motion"
},
"discoveryTopic": "binary_sensor/HC-MotionSensor/notification_home_security_motion_sensor_status/config",
"values": [
"113-0-Home Security-Motion sensor status"
],
"persistent": false,
"ignoreDiscovery": false,
"id": "binary_sensor_motion"
}

To whom may concern (@robertsLando maybe?)
I'm aware of #94 and #105 so I think with them ZwaveJS2MQTT is managing Motion Sensor in a better way but I have a suggestion: Is it possible to provide a "binary_sensor" (device_class = motion) mapping the motion to true and the idle status to false?
Basically something like the JSON I've defined (with improvements if they are needed).

Without it you still get the binary_sensor_contact (48-0-Any; no real use at least in my case due to its not updating value at all) but not a real binary_sensor for motion.
I'm aware you'll get the "Home_Security/Motion_sensor_status" notification device (with descriptive names thanks to @billiaz ) but in the end you will need to do the map in HASS if all you need is the usual motion binary_switch. Wouldn't be great providing that device from zwavejs2mqtt ready to be autodiscovered?

@AlCalzone
Copy link
Member

Still not understanding well how to put the sensor on group 4 (Motion BC) but I'll figure it out.

No, you don't put the sensor there. These are the device's groups. You put the controller (node 1) there so it receives the messages from group 4.

@katiuskt
Copy link
Author

No, you don't put the sensor there. These are the device's groups. You put the controller (node 1) there so it receives the messages from group 4.

Thank you @AlCalzone! It makes totally sense to me now!

@robertsLando
Copy link
Member

Is it possible to provide a "binary_sensor" (device_class = motion) mapping the motion to true and the idle status to false?
Basically something like the JSON I've defined (with improvements if they are needed).

Is this always like that? I mean is that value always used for such purposes? If so we can do it

@AlCalzone
Copy link
Member

The "any" sensor comes from an older CC version that does not specify the sensor type.
I don't think it is correct to always map that to motion.

@robertsLando
Copy link
Member

I don't think it is correct to always map that to motion.

That's what I was thinking

@katiuskt
Copy link
Author

OK, thanks, understood.

I'll close this issue and I'll create manually the device to map the CC-113 message (notification_home_security_motion_sensor_status) to a boolean binary_sensor (device_class = motion) as suggested by @billiaz

@Gis70
Copy link

Gis70 commented Feb 2, 2021

Hello guy's i'm facing the same issue, so what did you do exactly in zwave-js2mqtt to make the motion detection work ? could you explain ? thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed MQTT discovery MQTT discovery related
Projects
None yet
Development

No branches or pull requests

5 participants