Trouble making kapacitor deadman alert working

I need some help with setting up a deadman alert.

My goal is to fire an alert when some device stops sending any data due to some possible defect and send that alert on some rest endpoint.

In the format the alert is written now, it keeps hitting the endpoint even for some devices that keep pinging and in the body it says that the emitted value is above 0, usually 1 or 2.
Here is how the alert is written:

dbrp "example"."autogen"

var data = stream
    |from()
        .measurement('lamp')
    |eval(lambda: string("dev_addr"))
        .as('dev_addr')
        .tags('dev_addr')
    |groupBy('dev_addr')
    |where(lambda: isPresent("measurement_type"))

data
    |deadman(0.0, 2m)
        .stateChangesOnly()
        .post()
            .header('content-type', 'application/json; charset=UTF-8')
            .endpoint('host.docker.internal')

Not sure if the problem comes from the fact that the groupBy clause is by a field value. I found on github that you could do a groupBy when converting field to tag like i the code in there.