Configure MQTT to control start and stop of AgentDVR recording

  • Platform information:
    • Hardware: CPUArchitecture/RAM/storage
    • OS: what OS is used and which version
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version:2.5.10
  • Issue of the topic: please be detailed explaining your issue

I have configured AgentDVR (https://www.ispyconnect.com/userguide-agent-mqtt.aspx) to talk to my mosquitto mqtt instance. I currently use mqtt to control a number of Tuya switches and plugs. I have figured out what mosquitto_pub command I need to send on my Linux server to start/stop recording but I want to do that from within OpenHab. I can’t seem to figure out how to configure the Thing and Item that will allow me to do that within rules. For example I would like to record for 30 seconds whenever the front door is opened.

Here is the mosquitto_pub command that will accomplish what I want. I would appreciate it if someone could help or guide me towards the solution to implement it in Openhab.
mosquitto_pub -t “Agent/commands” -m “cmd=recordswitch&ot=2&oid=6” -h localhost

Thanks.

Do you have a Broker Thing setup so that openHAB is connected to Mosquitto? If not, do that first.

Then, one way of accomplishing what you want via rules is to use the MQTT Action, described at the end of the documentation. Note that in the example, mytopic is "Agent/commands" for you, and myvalue is "cmd=recordswitch&ot=2&oid=6" for you.

1 Like

Thanks so much for this, I used the MQTT Action and it worked perfectly!