hrntknr / push-watch

push-watch is a pushover client that executes a command each time it receives a notification.
Apache License 2.0
1 stars 0 forks source link

Seperation of run scripts. #2

Open tue-kyndal opened 1 year ago

tue-kyndal commented 1 year ago

Hi What a great idea. This is just what I was looking for - Thanks ;O)

I am thinking to use it for my alarm system, sending two pushover messages to my server to run a AlarmON.sh and AlarmOFF.sh scripts to set NVR status etc.

I am trying to run 2 instances of the script at the same time to watch for a ON and OFF signal

For test just run as.

./push-watch watch -p "0" xxxxxx yyyyyyyyyyyyyyyyyy echo "Alarm OFF P=0" &

./push-watch watch -p "1" xxxxxx yyyyyyyyyyyyyyyyyy echo "Alarm ON P=1" &

I get to running PIDs in htop, but only the last running instance react on a new push.

They work individually, but not in unison How can i separate 2 different pushover massages to run 2 different scripts. How is that intended to work if not with the only available -P flag?

Perhaps put a use case in the readme ;O)

tue-kyndal commented 1 year ago

And..just for info A few install hit wound gbe great for the common foke

I needed to copy the code to /usr/lib/go-1.15/src/push-watch to compile

on debian 11 in a proxmox CT

apt-get install git apt-get install golang cd /usr/lib/go-1.15/src/ git clone https://github.com/hrntknr/push-watch.git cd push-watch go build push-watch ;O)

hrntknr commented 1 year ago

Thanks for the feedback! I have added the information you are looking for to the readme. By the way, release binaries may be available for x86_64 linux. https://github.com/hrntknr/push-watch/tags

tue-kyndal commented 1 year ago

Thanks for the speedy reply and clarification.

My code on my alarm is set up for one push with one token, and the information about Alarm On/Off is carried within the topic.

So a -T flag to filer on the topic - to separate "Alarm-ON" and "Alarm-OFF" topic to the different run-scripts would be great ;O) I understand I need to devices...but they will be under the same "Alarm" delivery group for my Application Token, and both get the same pushover message...just with different topics.

Thanks for the good work. I may rewrite the code and revert to my MQTT server to solve it with Node-RED. But this did look rather nice. And I believe my use-case could be rather common.

hrntknr commented 1 year ago

Thank you for your help in improving this project. Just FYI, what do you mean "topic"? There is no topic in pushover like there is in mqtt, I think only users, groups, and devices can be specified as publication destinations. (I don't understand which fields you want to filter with the -T flag.)

https://pushover.net/api

tue-kyndal commented 1 year ago

true...I mean title ;O)

hrntknr commented 1 year ago

The assumption policy is that such programs are simpler and should not be beyond the scope of the pushover protocol.

If the intention is to "create a field that corresponds to a topic by extending a message or other field," then this program should not support such a field. (It should be extended in a shell script using PUSHOVER_MESSAGE, etc.) On the other hand, if the intent is to "use a field such as title as a topic," I think it is acceptable to support it.

tue-kyndal commented 1 year ago

Thank you for your comment. After having played with it, I realize that every Pushover Group has an individual key, and this ca be used to designate the correct push..separated on the group ...Eg. Group ALARM and Group ALARM ON/OFF etc. So i don't need to sort on the Title anyway.

Only issues is now that below sketch for Arduino, does for some reason not work for Group Keys..only primary Keys ;O(

I have made a support case with Push Over.

https://forum.arduino.cc/t/pushover-sketch-to-send-pushover-messages-from-the-arduino/236734