azogue/eventsensor

Parse booleans in event data filter

Closed this issue · 2 comments

Hi @azogue ,

I had some time now to play around with it. I've got one example that I can't get to work:

I get this event:

{
    "event_type": "netatmo_event",
    "data": {
        "type": "person",
        "data": {
            "user_id": "x",
            "persons": [
                {
                    "id": "x",
                    "face_id": "x",
                    "face_key": "x",
                    "is_known": true,
                    "face_url": "x"
                }
            ],
            "snapshot_id": "x",
            "snapshot_key": "x",
            "snapshot_url": "x",
            "event_type": "person",
            "camera_id": "x",
            "device_id": "x",
            "home_id": "x",
            "home_name": "x",
            "event_id": "x",
            "message": "Fabian von Camera Treppenhaus gesehen",
            "push_type": "NACamera-person",
            "id": "x",
            "name": "Fabian",
            "is_known": true,
            "face_url": "x"
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-08-07T08:09:49.610627+00:00",
    "context": {
        "id": "x",
        "parent_id": null,
        "user_id": null
    }
}

And I've got this event sensor setup:
image

For some reason, I can't get the sensor to fire once I add the data.is_known: true to the event filter. Without it it works fine, but as soon as I add the above filter (data.is_known: true) to the other filters the sensor doesn't fire anymore.

Originally posted by @Fabenissimo in #13 (comment)

Hi @Fabenissimo,

I moved your comment to a new issue. What you're experiencing is the lack of value parsing for that filter data.is_known: true (it is searching for "true" as a string).

I'll try with data.is_known: 1 to test if that way it works, but probably won't :(

When I have some time to spare I'll try to implement boolean parsing for these scenarios...

@Fabenissimo, this feature (about parsing booleans) is already included in the last release (v2.4.1)

I just tried this exact example and it worked as expected, so I'm closing this one :)