How to read events from Z-Wave in HA?

Hello everybody,

I have installed a qubino din dimmer in my z-wave network.
The dimmer is working perfectly when switched from the wall switches and when using HA frontend.
My problem is that I can’t distinguish between switching on by the wall switch and switching on between a motion sensor.

I got an info from qubino support showing a difference in a hex dump.

Switched by wall switch (hardware)
image

switched by HA (software)
image

How can I see this in HA, either as event or a state change???

Thanks for helping out.
Ralf

It’ll be displayed as a sensor.

Hi firstof9,
unfortunately I don’t see the hex info in any of the sensors that are provided by the device.

Thanks
Ralf

It won’t be in hex, you should have a sensor.whatever_watts etc.

Yes, I have that. That’s the easy part.
Now I want to see whether the dimmer was switched on by the wall switch or by software and this is only showing in these hex data. It’s showing from which node id the switch command was sent. Either 19 -> 1 or 1 -> 19.
The available sensor data is this:


Plus of course the dimming level:
image

I suppose, this HEX data might be evaluated from the ozw_logs.txt file but I don’t see any way to do it inside HA.

Thanks again
Ralf

There is nothing in the Report that tells you whether it was the result of a z-wave command or physical button press.

Last I checked the logbook kept track if someone did something via the UI.

image

How about creating a listener for the state change?

I just looked in the events dev tool and saw this example for a zwave device:

Event 323 fired 10:02:
{
    "event_type": "state_changed",
    "data": {
        "entity_id": "zwave.kitchen_ms6",
        "old_state": {
            "entity_id": "zwave.kitchen_ms6",
            "state": "ready",
            "attributes": {
                "node_id": 27,
                "node_name": "AEON Labs ZW100 MultiSensor 6",
                "manufacturer_name": "AEON Labs",
                "product_name": "ZW100 MultiSensor 6",
                "query_stage": "Complete",
                "is_awake": true,
                "is_ready": true,
                "is_failed": false,
                "is_info_received": true,
                "max_baud_rate": 40000,
                "is_zwave_plus": true,
                "capabilities": [
                    "listening",
                    "zwave_plus",
                    "routing",
                    "beaming"
                ],
                "neighbors": [
                    32,
                    1,
                    6,
                    7,
                    11,
                    12,
                    17,
                    24,
                    29,
                    30,
                    31
                ],
                "sentCnt": 40,
                "sentFailed": 0,
                "retries": 0,
                "receivedCnt": 2113,
                "receivedDups": 5,
                "receivedUnsolicited": 2092,
                "sentTS": "2020-12-01 10:01:43:730 ",
                "receivedTS": "2020-12-01 10:02:28:528 ",
                "lastRequestRTT": 192,
                "averageRequestRTT": 110,
                "lastResponseRTT": 2415,
                "averageResponseRTT": 1836,
                "battery_level": 100,
                "wake_up_interval": 240,
                "application_version": "1.10",
                "friendly_name": "Kitchen MS6"
            },
            "last_changed": "2020-12-01T00:37:57.332952+00:00",
            "last_updated": "2020-12-01T02:02:28.632795+00:00",
            "context": {
                "id": "2bfdaf53b6aa56aea9e903134283d53e",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "zwave.kitchen_ms6",
            "state": "ready",
            "attributes": {
                "node_id": 27,
                "node_name": "AEON Labs ZW100 MultiSensor 6",
                "manufacturer_name": "AEON Labs",
                "product_name": "ZW100 MultiSensor 6",
                "query_stage": "Complete",
                "is_awake": true,
                "is_ready": true,
                "is_failed": false,
                "is_info_received": true,
                "max_baud_rate": 40000,
                "is_zwave_plus": true,
                "capabilities": [
                    "listening",
                    "zwave_plus",
                    "routing",
                    "beaming"
                ],
                "neighbors": [
                    32,
                    1,
                    6,
                    7,
                    11,
                    12,
                    17,
                    24,
                    29,
                    30,
                    31
                ],
                "sentCnt": 40,
                "sentFailed": 0,
                "retries": 0,
                "receivedCnt": 2114,
                "receivedDups": 5,
                "receivedUnsolicited": 2093,
                "sentTS": "2020-12-01 10:01:43:730 ",
                "receivedTS": "2020-12-01 10:02:28:687 ",
                "lastRequestRTT": 192,
                "averageRequestRTT": 110,
                "lastResponseRTT": 2415,
                "averageResponseRTT": 1836,
                "battery_level": 100,
                "wake_up_interval": 240,
                "application_version": "1.10",
                "friendly_name": "Kitchen MS6"
            },
            "last_changed": "2020-12-01T00:37:57.332952+00:00",
            "last_updated": "2020-12-01T02:02:28.791187+00:00",
            "context": {
                "id": "948372869934719e63fb95c2faa293aa",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-12-01T02:02:28.791187+00:00",
    "context": {
        "id": "948372869934719e63fb95c2faa293aa",
        "parent_id": null,
        "user_id": null
    }
}

Without spending much time looking at the above I’m not sure but perhaps in your event stream you would see the device updating when motion is detected?

Hi folks,
I think I found something with your help.
Yes, in the event_listener I find the events of switching on and off the light.
Yes, in the event_listener I can find a user_id in the context of the event.

Yes, in the logbook I see, who switched on the lamp (at least when using HA to switch) and I see an entry in the logbook when I use the wall switch (without a username or an entry like hass-io).

Tonight I will check, which user_id is note in the event_listener when I use the wall switch and crosscheck with the logbook.

Ha, coming closer with some ideas from your side! Thanks!!!

Will report back later :slight_smile:

Definitely a solution is on hand.

When I use the wall switch to toggle the light the user_id in the context of the new state is null, so it’s easy to identify.
All other software induced actions have a value <>null in this field, so easy to identify as well.

Here a screenshot from my node-red message output of the sensor:

Thanks again to everybody :sunglasses: