homebridge-camera-ffmpeg icon indicating copy to clipboard operation
homebridge-camera-ffmpeg copied to clipboard

MQTT doorbellMessage JSON input

Open roysbike opened this issue 3 years ago • 6 comments

Doorbell dahua vto2111d-wp. Can parsing json? When I press the call on the call, then the message comes in json

{ "Action": "Start", "Code": "CallNoAnswered", "Data": { "CallID": "8", "IsEncryptedStream": false, "LocaleTime": "2021-08-25 10:37:35", "LockNum": 2, "SupportPaas": false, "TCPPort": 37777, "UTC": 1629877055.0, "UserID": "9901" }, "Index": 0, "serialNumber": "7E02BF7PAJD7071" }'

I need doorbellMessage= JSON block = "Action": "Start"

"mqtt": {
            "doorbellTopic": "DahuaVTO/CallNoAnswered/Event",
            "doorbellMessage": "Start"
        }

roysbike avatar Aug 25 '21 10:08 roysbike

I’m open to adding this, if I can think of a reasonable way to define it in the config without breaking existing users.

Sunoo avatar Sep 05 '21 05:09 Sunoo

Okay, I’ve got an idea on how this might be able to work. I’ll try to do some testing this weekend.

Sunoo avatar Sep 10 '21 20:09 Sunoo

I was just trying to figure out how to do this. I have zigbee2mqtt occupancy sensor publishing this and want to trigger a doorbell. If the doorbellMessage could accept a "regex" or wildcard pattern it could be easy.

Topic: zigbee2mqtt/Motion Sensor
{"battery":100,"battery_low":false,"linkquality":107,"occupancy":true,"tamper":false,"voltage":3200}

example:

"mqtt": {
        "doorbellTopic": "zigbee2mqtt/Motion Sensor",
        "doorbellMessage": "*\"occupancy\":true"
             }

magic7s avatar Oct 08 '21 17:10 magic7s

Parsing it as JSON and letting the user specify a path would be preferred. I have an idea on how to handle it, my life just suddenly got pretty crazy so I haven’t had time or energy to work on it recently.

Sunoo avatar Oct 08 '21 17:10 Sunoo

an easy alternative is using mqtt-launcher + a small python json parser to automatically generate another mqtt msg when receiving the full json. For ex,mqtt-launcher listen to zigbee2mqtt/Motion Sensor and publish a zigbee2mqtt/Motion Sensor/report that contains the trigger you want to see (eg : 'alarm')

mfauvain avatar May 14 '23 19:05 mfauvain