Received MQTT topic not starting AutoHotkey script.

Here you are welcome to report any Push2Run bugs you may have encountered

if you know of a workaround, it would be great if you would mention that too
Post Reply
SanguShellz
Posts: 0
Joined: Sat Jun 29, 2024 5:21 pm

Received MQTT topic not starting AutoHotkey script.

Post by SanguShellz »

I use Home Assistant with MQTT topics to startAutoHotkey scripts in Windows11. The Script doesn't start after upgrading to v4.8.3 but it does with v4.6. I normally use # in the filter, but i also put the tried the literal topic also. I tried with and without admin privileges, and I tried with a compiled AutoHotkey script.


Push Card Details :
================
Description: Turn Brown Noise On
Listen For: noise_on
Open: D:\My Tools\AHK\Repo\Noise Box\BN_On.exe
Start Directory: D:\My Tools\AHK\Repo\Noise Box\


Home Assistant .yaml scripts:
=========================
bnoise_on_mqtt:
alias: "MQTT: Start Brown Noise"
sequence:
- service: mqtt.publish
data:
topic: "noise_on"
payload: on <-- also used true

bnoise_off_mqtt:
alias: "MQTT: Stop Brown Noise"
sequence:
- service: mqtt.publish
data:
topic: "noise_off"
payload: on


v4.6 Session Log:
===============
2024-06-29 16:30:41.321 - MQTT incoming message:
2024-06-29 16:30:41.322 - Topic: noise_off
2024-06-29 16:30:41.322 - Payload: True

2024-06-29 16:30:44.015 - command processed based on the 'No matching phrases' card
2024-06-29 16:30:44.015 - command processed based on the 'No matchingdoub phrases' card
2024-06-29 16:30:44.016 - No matching phrases found

2024-06-29 16:32:40.508 - MQTT incoming message:
2024-06-29 16:32:40.510 - Topic: noise_on
2024-06-29 16:32:40.510 - Payload: True

2024-06-29 16:32:43.208 - command processed based on the 'No matching phrases' card
2024-06-29 16:32:43.208 - command processed based on the 'No matchingdoub phrases' card
2024-06-29 16:32:43.208 - No matching phrases found


v4.8.3 Session Log:
================
2024-06-29 16:37:01.913 - MQTT incoming message:
2024-06-29 16:37:01.913 - Topic: noise_on
2024-06-29 16:37:01.916 - Payload: True

2024-06-29 16:37:02.139 - No matching phrases found

2024-06-29 16:37:35.670 - MQTT incoming message:
2024-06-29 16:37:35.671 - Topic: noise_off
2024-06-29 16:37:35.672 - Payload: True

2024-06-29 16:37:35.849 - No matching phrases found
RobLatour
Site Admin
Posts: 1016
Joined: Mon Feb 19, 2018 11:43 am

Re: Received MQTT topic not starting AutoHotkey script.

Post by RobLatour »

A couple things:

1. Push2Run will match on your MQTT publications payload (not topic):

ref: https://www.push2run.com/help/help_v4.8.3.0.html
Once a MQTT topic is subscribed to, and when a MQTT publication with a matching topic is received by Push2Run, Push2Run will check if any of your Push2Run cards have a 'Listen for' field matching the MQTT publication's payload, and if so Push2Run will run those matching Push2Run cards.
2. In your logs, for version 4.6 the program is matching on the 'No matching phrases' card, however the same match is not showing up in your 4.8.3 logs.
How this works is described here:
https://www.push2run.com/help/help_v4.8 ... ml#nomatch
(under where it says "Performing actions when there are no matching or enabled phrases".

Accordingly, with version 4.8.3 can you please double check the card "no matching phrases" is turned on (I suspect it may have been turned on when you were using 4.6 and turned off when you were using 4.8.3).

Also, as an aside, the log entry:

2024-06-29 16:32:43.208 - command processed based on the 'No matching phrases' card

signifies what is happening, while the line entry directly below it:

2024-06-29 16:30:44.015 - command processed based on the 'No matchingdoub phrases' card

signifies I didn't have enough coffee in my system when I coded that display. The second display line in the log will be eliminated in the next release - thanks for drawing my attention to it.

Finally, for what you are doing, is there a way you can change things up to provide a more descriptive payload which can be used to be reliably match upon?

Please let me know if this all makes sense / helps?
RobLatour
Site Admin
Posts: 1016
Joined: Mon Feb 19, 2018 11:43 am

Re: Received MQTT topic not starting AutoHotkey script.

Post by RobLatour »

ok - thanks for the updated.

Perhaps the no matching card thing was a bug in 4.6 which is gone in more recent releases - I just don't remember that as something I needed to fix and I usually document all that stuff.

Regardless, glad everything is working for you now.

Hope you get good use out of the program!

Cheers
Post Reply