Coder Social home page Coder Social logo

Comments (24)

VorlonCD avatar VorlonCD commented on August 12, 2024 1

Ok, I expect issues since I havent tested, even with mosquitto, but try dis

You have to edit mqtt_serverandport, mqtt_username, mqtt_password directly in the .JSON config file. Leave username blank if there is none.

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024 1

@packetwarrior - I fixed a few MQTT related bugs that certainly would have stopped it from working on your end, but I'm still having a hard time testing - not exactly sure what is expected, and the test servers keep giving 'unable to connect to the remote server' (maybe I abused them or have too many connections) - iot.eclipse.org, broker.hivemq.com, test.mosquitto.org. Using default port of 1883.

In the new version, see camera > settings > MQTT > Settings screen, and the TEST button

AITOOL-VORLONCD.zip

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024 1

See if this guy is working any better for you.
AITOOL-VORLONCD.zip

from bi-aidetection.

packetwarrior avatar packetwarrior commented on August 12, 2024 1

I think we have a winner here, initial testing looks really good, will do some more checking tomorrow. In theory, one could also control Blue Iris now, without having to deal with Trigger URLs and web server configuration issues.

Thank you very much for all the extra effort you're putting into this, I know debugging these seemingly minor issues can be a major headache. Great job!

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024 1

@ccmacaluso Try it. Its in the latest release:
https://github.com/VorlonCD/bi-aidetection/releases

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

I've never used it, can you provide more detail and examples? Would it need to support AUTH TLS like blue iris?

from bi-aidetection.

packetwarrior avatar packetwarrior commented on August 12, 2024

MQTT follows the Publisher/Subscriber model, with the messages organized in topics. In case of alerting, only the subscriber portion matters.

Check out https://mosquitto.org which even discusses how you can use their test setup to validate your components are working. From what I can tell, most of the applications I use actually rely on the Mosquitto libraries to do all the heavy lifting, which is all open source.

Ideally, authentication should be supported, and if possible TLS as well (which should be easier when using the Mosquitto libraries).

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

what does your topic/payload look like?

from bi-aidetection.

packetwarrior avatar packetwarrior commented on August 12, 2024

Hopefully these examples make sense:

AI Tool as a Subscriber (via EventGhost right now):
topic: hostname_eg/aitool/driveway/motion
payload: [parameters]

Blue Iris as a Publisher (alert):
topic: hostname_bi/c_driveway
payload: 0 or 1 (motion started vs stopped)

Blue Iris as a Subscriber
Example of my home automation triggering Blue Iris to record the driveway camera
topic: hostname_bi/admin
payload: camera=driveway&trigger&memo=garage_door

from bi-aidetection.

packetwarrior avatar packetwarrior commented on August 12, 2024

wow, that was fast!

I didn't have much time to test this, but the first run didn't trigger. After it processed the first pic, the log showed it saved the settings again, which removed the MQTT entries (probably because there's no GUI entry for them?).

I'll do some more testing tomorrow, but your work is very much appreciated!

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

@packetwarrior - Thanks for testing!

So you would have to edit the mqtt settings in the JSON file when the program is NOT running, otherwise it would have overwritten the settings you manually edited.

I'll need logs if still not working as expected. (stripped of any passwords of course :)

from bi-aidetection.

packetwarrior avatar packetwarrior commented on August 12, 2024

Alright major progress for sure!

  • The Test button in the MQTT Settings dialog box works perfectly (shows [camera] as payload, but that makes sense).
  • When I throw a new pic in the directory, it triggers the MQTT alert (so connection is good), however it's being posted to the / topic, and the payload is the content of Params from the previous "Run external program" option, so probably just a bad variable reference?

I did test the test.mosquitto.org server with my MQTT client, which works, but there were so many topics posted, it took a few minutes to load. Check out https://www.hivemq.com/mqtt-toolbox/ for some of the popular clients.

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

How is this working? (The test screen will still not resolve [camera] etc)

AITOOL-VORLONCD.zip

from bi-aidetection.

packetwarrior avatar packetwarrior commented on August 12, 2024

Unfortunately, same behavior. For testing purposes, I saved the settings again, but changed the (disabled) run external program 'Params' text box to the literal string "params value". In the logs below, you can see it's using that value for both the topic and payload content.

[15:38:45.840]:            DetectObjects> x.x.x.x:5000 - The summary:car (99.42%)
[15:38:45.844]:            DetectObjects> x.x.x.x:5000 - (5/6) Performing alert actions:
[15:38:45.846]:                  Trigger>    Copying image to network folder...
[15:38:45.852]:                  Trigger>    -> Image copied to network folder.
[15:38:45.856]:             PublishAsync> MQTT: Sending topic 'params value' with payload 'params value' to server 'mqtt.server:1883'...
[15:38:45.862]:             PublishAsync> MQTT: ### CONNECTED WITH SERVER 'mqtt.server:1883' ### - Result: Success, ''
[15:38:45.868]:             PublishAsync> MQTT: ### SUBSCRIBED to topic 'params value'
[15:38:45.888]:             PublishAsync> MQTT: ...Sent in 31ms, Reason: 'Success' (0 - '')

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

Driving me buggy, I dont see any bad variable references. :) I can change topic and payload in actions and it sticks - Maybe you are also running as service and settings dont stick because of that?

What if you make sure AITOOL.EXE has been fully closed in task manager, then edit AITOOL.SETTINGS.JSON file for the camera in question:

   "Action_mqtt_topic": "topic",
    "Action_mqtt_payload": "payload",

from bi-aidetection.

packetwarrior avatar packetwarrior commented on August 12, 2024

The settings are sticking fine (no service configured, and I wouldn't be able to overwrite the executable if it was still running), it's just not using them. This is pulled from my Settings file, which the UI also reflects:

"Action_mqtt_enabled": true,
"Action_mqtt_topic": "ai/[camera]/motion",
"Action_mqtt_payload": "[detections]",
"Action_mqtt_retain_message": false,

from bi-aidetection.

ccmacaluso avatar ccmacaluso commented on August 12, 2024

This featureset would be incredible if we could get it into the next release of AITool. Let me know if I can help to test.

from bi-aidetection.

edalquist avatar edalquist commented on August 12, 2024

Verified this works for me as well, thanks for adding it!

from bi-aidetection.

willngogit avatar willngogit commented on August 12, 2024

just stumbled on this fork, awesome work! feature request: currently, MQTT only fires when there a relevant alert. Can you make it configurable where it would fire when there's no relevant objects as well? I'm planning to use this as an occupancy sensor. it would be good to do a check to make sure there are no persons in the room before turning off the lights.

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

@willngogit - Done.

https://github.com/VorlonCD/bi-aidetection/releases

from bi-aidetection.

willngogit avatar willngogit commented on August 12, 2024

Wow.. that was quick!

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

@willngogit - tiny bug fix if you already downloaded, re-download.

from bi-aidetection.

willngogit avatar willngogit commented on August 12, 2024

@willngogit - tiny bug fix if you already downloaded, re-download.

re-downloaded. seems to be working. thanks!

from bi-aidetection.

VorlonCD avatar VorlonCD commented on August 12, 2024

This version will use the "Last Will" feature of MQTT. When it first connects it will send a LWT "AITool/status" topic with payload of "Offline". So you should see that message if AITOOL ever crashes and you are using MQTT. When it connects it now sends "Online" to the same topic. If you want to change this, close the program, edit AITOOL.SETTINGS.JSON and change "mqtt_LastWillTopic" and "Mqtt_LastWillPayload" settings.

AITool-VorlonCD-v2.0.569.zip

Let me know how it works.

from bi-aidetection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.