Two Tone Detect and Batch file - Alert System

Status
Not open for further replies.

nated1992

Member
Joined
Feb 9, 2013
Messages
271
Location
Asheville NC
Hey i have been playing with two tone detect using a batch file to set off station tones when we receive a call. I wrote a short bat script which plays a audio file then when the record time starts the audio is past threw and i figured out how to rout this threw the computer and to our station amplifier to feed the speakers. With testing it i found it gets really clear sound and allows for configuring specific alert tones such as it announcing engine call on a tone or EMS call for another. I also found i liked it better then the Informer we had.

Has any one had any other use with this..

Im curious to find away to make it control other stuff such as lights or doors...

Thus would have to be software controlled. For apparent reason a relay isn't practical

So who else has used two tone and batch files and what have you came up with?
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
Hey i have been playing with two tone detect using a batch file to set off station tones when we receive a call. I wrote a short bat script which plays a audio file then when the record time starts the audio is past threw and i figured out how to rout this threw the computer and to our station amplifier to feed the speakers. With testing it i found it gets really clear sound and allows for configuring specific alert tones such as it announcing engine call on a tone or EMS call for another. I also found i liked it better then the Informer we had.

Has any one had any other use with this..

Im curious to find away to make it control other stuff such as lights or doors...

Thus would have to be software controlled. For apparent reason a relay isn't practical

So who else has used two tone and batch files and what have you came up with?

My experience is with the raspberry pi $35 micro computer and python scripts rather than windows. Yes, you can make it do nearly anything that you can think of. You will need a relay that is CONTROLLED by the software. Then use this relay to control lights, open doors, etc. while you are at it you can also set up a web page on the pi that you can access from your smart phone with buttons that allow you to do all these things manually from your phone also.

Do a search on Amazon for sainsmart relay. http://www.amazon.com/SainSmart-2-C...s=Sainsmart&qid=1459857476&ref_=sr_1_5&sr=8-5

Be careful with overhead door control. You don't want someone in Over Yonder closing the door as your apparatus is driving through it! One of the most useful applications I can think of would be to control an electric door striker on a personnel door at an unmanned station. Your tones could make the door go unlocked for say 15 minutes upon tone activation. Or you could put a "open button" for your bay door on the outside of the station and wire the relay to make it active only for that 15 minute post-tone window.

I know of another user also putting together a station audio alerting system as you describe, using a pi.
 

K1STBDENIS

Member
Joined
Jun 19, 2010
Messages
8
Location
Kennebeck County Maine
Paging 2 tones

I build tone alert units for FD and volunteers, I also decode tones.
I have mine trip a gamewell bell for fire and a horn for the rescue / ambulance.
need more info k4stb@aol.com use gamewell in subject line
denis
 

nated1992

Member
Joined
Feb 9, 2013
Messages
271
Location
Asheville NC
My experience is with the raspberry pi $35 micro computer and python scripts rather than windows. Yes, you can make it do nearly anything that you can think of. You will need a relay that is CONTROLLED by the software. Then use this relay to control lights, open doors, etc. while you are at it you can also set up a web page on the pi that you can access from your smart phone with buttons that allow you to do all these things manually from your phone also.

Do a search on Amazon for sainsmart relay. http://www.amazon.com/SainSmart-2-C...s=Sainsmart&qid=1459857476&ref_=sr_1_5&sr=8-5

Be careful with overhead door control. You don't want someone in Over Yonder closing the door as your apparatus is driving through it! One of the most useful applications I can think of would be to control an electric door striker on a personnel door at an unmanned station. Your tones could make the door go unlocked for say 15 minutes upon tone activation. Or you could put a "open button" for your bay door on the outside of the station and wire the relay to make it active only for that 15 minute post-tone window.

I know of another user also putting together a station audio alerting system as you describe, using a pi.

Hey this sounds great i will have to look into it!
 

nated1992

Member
Joined
Feb 9, 2013
Messages
271
Location
Asheville NC
I build tone alert units for FD and volunteers, I also decode tones.
I have mine trip a gamewell bell for fire and a horn for the rescue / ambulance.
need more info k4stb@aol.com use gamewell in subject line
denis

Do you use software to do this our a pager and amplified charger... It sounds like the pager setups i have seen?
 

KB4RU

Member
Joined
Jan 23, 2015
Messages
4
I have been working on setting up TwoToneDetect in order to turn on a red LED light to illuminate a room, flash either a Blue, Green, or Red light indicating which tones dropped, and turn the radio on to overhead speakers. I was trying to use the SainSmart relay board, but had nothing but problems. I found using the KMTronic relay board is MUCH easier to right .bat files for. I put the USBRelay.exe on the C drive and uses command line to turn the relays on and off.

I made another .bat file that acts as a failsafe and turns on the radio audio all the time when TwoToneDetect closes or the computer turns off. When TTD is opened, it turns off the failsafe and turns the radio off.
 

davidVT

Member
Feed Provider
Joined
Aug 29, 2010
Messages
138
Location
Washington County,Vermont
FYI I use MQTT , NODE-RED and inexpensive SONOFF wifi modules for alerting when my wood boiler needs wood or overheats. It works great!

I will soon connect the TTD system to NODE-RED in pursuit of alerting / turning on lights with pages.

I believe NODE-RED comes in the normal raspian OS for Pi and should coexist with TTD for those using TTD on Pi. NODE-RED will connect to the SONOFF wifi switch via your local wifi. You will also have to install a simple MQTT server (mosquito).

One could simply call a URL into NODE-RED from a batch file to trigger a light or other item with just NODE-RED and one of these wifi switches.

https://www.itead.cc/sonoff-wifi-wireless-switch.html

These switches need to have firmware changed to operate with MQTT&NODE-RED ( I prefer ESPEASY). The first time is challenging then quite easy after that. I am using the 4 channel SONOFF versions now. They might work well for having a different relay for different tones.

Once you get into NODE-RED there are a ton of things you can do with that including email, tweeting, etc.
:)

Ah, boiler light just came on, time to go out and feed the beast....

Sent from my iPad using Tapatalk
 
Last edited:

nated1992

Member
Joined
Feb 9, 2013
Messages
271
Location
Asheville NC
FYI I use MQTT , NODE-RED and inexpensive SONOFF wifi modules for alerting when my wood boiler needs wood or overheats. It works great!

I will soon connect the TTD system to NODE-RED in pursuit of alerting / turning on lights with pages.

I believe NODE-RED comes in the normal raspian OS for Pi and should coexist with TTD for those using TTD on Pi. NODE-RED will connect to the SONOFF wifi switch via your local wifi. You will also have to install a simple MQTT server (mosquito).

One could simply call a URL into NODE-RED from a batch file to trigger a light or other item with just NODE-RED and one of these wifi switches.

https://www.itead.cc/sonoff-wifi-wireless-switch.html

These switches need to have firmware changed to operate with MQTT&NODE-RED ( I prefer ESPEASY). The first time is challenging then quite easy after that. I am using the 4 channel SONOFF versions now. They might work well for having a different relay for different tones.

Once you get into NODE-RED there are a ton of things you can do with that including email, tweeting, etc.
:)

Ah, boiler light just came on, time to go out and feed the beast....

Sent from my iPad using Tapatalk

I will have to look into this I've been doing a lot with it and have came up with a pretty good system
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
FYI I use MQTT , NODE-RED and inexpensive SONOFF wifi modules for alerting when my wood boiler needs wood or overheats. It works great!

I will soon connect the TTD system to NODE-RED in pursuit of alerting / turning on lights with pages.
I believe NODE-RED comes in the normal raspian OS for Pi and should coexist with TTD for those using TTD on Pi. NODE-RED will connect to the SONOFF wifi switch via your local wifi.

One could simply call a URL into NODE-RED from a batch file to trigger a light or other item with just NODE-RED and one of these wifi switches.

https://www.itead.cc/sonoff-wifi-wireless-switch.html

These switches need to have firmware changed to operate with NODE-RED. The first time is challenging then quite easy after that. I am using the 4 channel SONOFF versions now. They might work well for having a different relay for different tones.

Once you get into NODE-RED there are a ton of things you can do with that including email, tweeting, etc.
:)

Ah, boiler light just came on, time to go out and feed the beast....

Sent from my iPad using Tapatalk

Interesting. Are you controlling your wifi switches locally, or is that being done through a remote server as outlined on the Sonoff pages?

I have my domestic hot water heated by my wood boiler using a dedicated circulator pump and heat exchanger. A pi monitors top and bottom temperatures in the hot water tank and controls the circulator through Cayenne (mydevices.com). I have found their server a little unreliable so have also hard coded a high temp limit directly into the pi as a backup to the Cayenne control. Curious as to how reliable you have found the sonoff server, if your setup uses it.

I have had no trouble controlling a SainSmart relay with my pi.
 

davidVT

Member
Feed Provider
Joined
Aug 29, 2010
Messages
138
Location
Washington County,Vermont
I like the Sainsmart relay idea. I need some switches for low power switching and those might work well. I am moving away from Pi towards esp8266 for wifi hardware control. Will see if these relays will work on the slightly lower voltage.

The SONOFF are only switching mains voltage so 110vac in most cases here but ok in Europe also.

The SONOFF server is replaced with a local MQTT server and NODE-RED which both can easily run on the Pi. My MQTT is on a virtual Debian box. The SONOFF needs to have it's firmware flashed to use the above for which there are many options. I use EASYESP which does what I need. What I like about EASYESP is that it has local rules. Example you could connect a temp sensor to the SONOFF and use that SONOFF to not only do the communication to your local server but also program a fail safe temperature to power the circulator on it's own. Of course a mechanical thermal snap switch or aquastat could do that also but what is the fun in that?

My 4 relay SONOFF also now has a RJ45 jack to support a string of one wire temperature sensors.

So, sensors feed MQTT server which feeds NODE-RED. NR evaluates the temp data and makes decisions to alert us by turning on SONOFF switches with lights attached.
The setup is IOT so house lights are on sunset timers etc.
I can log into the house from anywhere and check on things.
IFTTT can see my phone when I get home so to automatically turn lights on via a URL to NODe-RED if needed.. :)

Some good YouTube stuff on the SONOFF mods.

UPDATE:
For just turning on a light, you can skip most of the above.
Use EASYESP firmware update on SONOFF and command the unit directly via a URL from TTD batch file.
Example: (the IP is one of the Sonoff's at my home)
http://192.168.0.183/control?cmd=GPIO,12,1
Turns relay on
http://192.168.0.183/control?cmd=GPIO,12,0
Turns relay off
(Or perhaps use the local rules for a timer to turn it off)

So on my TTD Pi I made a script (lighton.sh) and did chmod +x and ran if from the command line successfully. The SONOFF connected light came on!!
----lighton.sh---
content=$(wget http://192.168.0.183/control?cmd=GPIO,12,1)
echo $content
-----------------
Can someone help me with my TTD Pi for exactly how to put this script in tones.cfg and where the script needs to live so I can finish the test??


Remember with the MQTT server and NODE-RED you can control countless of these SONOFFs all over a house (or fire house) and make complicated rules for them etc etc


Sent from my iPad using Tapatalk
 
Last edited:

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
I



So on my TTD Pi I made a script (lighton.sh) and did chmod +x and ran if from the command line successfully. The SONOFF connected light came on!!
----lighton.sh---
content=$(wget http://192.168.0.183/control?cmd=GPIO,12,1)
echo $content
-----------------
Can someone help me with my TTD Pi for exactly how to put this script in tones.cfg and where the script needs to live so I can finish the test??

From TwoToneDetect.net:

Version 51 Release Notes:
– Added two optional parameters that can be added to each tone set in the tones.cfg file:
alert_command – this is a command line that will be executed immediately upon detection of a valid tone set
post_email_command – this is a command line that will be executed after a valid tone set has been detected and emails have been sent
– The program will now re-read the email information from the tones.cfg file each time a valid tone set is detected. Note that it does NOT reread all info from the tones.cfg file, only the email info

So, add another line in your [ToneX] section: alert_command = lighton.sh

Your lighton.sh script needs to be in the same directory as your TTD program file.

I think that will work, the ones that i have used are python scripts and i use alert_command = python XXX.py

Jim
 

davidVT

Member
Feed Provider
Joined
Aug 29, 2010
Messages
138
Location
Washington County,Vermont
756e2fd2a79471309215c036b20b5f93.jpg


Four channel din mount SONOFF all set for test tones. 3 of the 4 relay/LED combos are set to my three important tone sets. Just using the alert command script in TTD. Fingers crossed.

Currently the relay will simply be reset by the button on the unit. A timer can be implemented locally to reset but no time to do that for now.


Sent from my iPhone using Tapatalk
 

nated1992

Member
Joined
Feb 9, 2013
Messages
271
Location
Asheville NC
Just an interesting update:
There are new sonoff 'pro' 4 channel units with dry contacts rather than line powered contacts. That creates new options for using the sonoff with TTD for signaling and perhaps audio switching (ymmv).

https://www.itead.cc/sonoff-4ch-pro.html




Sent from my iPad using Tapatalk

I actually have a extremely stable version of this working on both Linux and Windows. The windows version uses USB Relays and the Linux uses the Pi GPIO pins.

I have a contract with The Maker of TTD to resale it as a whole unit, Or i sell just the pi and scripts with instructions on how to use it with TTD "Usually its easier to sale the whole unit If i would actually sell any" I hope to add more features to the scripts but currently...
Will do all the features of the TTD Software.
Will turn on relay boards USB or GPIO "I like the Pi version better"
Will sound an alert tone before playing the audio can do a different sound to each separate tone set "alternatively the audio can be constantly passed through to always here the scanner/radio"
The audio can be set to play for different duration 1 to whatever seconds
The relays can be set to time out or stay on until a rest is pressed.

I am sending a message today to see if i can get a editable version to the GUI to change and add some options for my scripts.
 
Joined
Oct 23, 2009
Messages
844
Location
Lincoln, NE
I have TTD running on W10 VM and Node-Red in a docker. How would I setup a cmd in TTD to be a trigger in node-red?

I have a email trigger setup, but I'd like a local trigger.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
There’s likely 1000 ways to skin this cat. Thanks to DavidVT, i took a look at node-red and MQTT. Long story short, i have set up an MQTT broker on a pi, TTD publishes a message to it when a tone is decoded through the alert_command parameter. I pass the Description argument [d] to the python script so it knows which of my 50+ tone sets decoded. Now, using node-red, I can subscribe to mqtt topics that are specific to each tone set. Then you can do whatever you wish (relays, lights, sounds, door locks, OH doors, etc.). The mqtt topic gives you that electronic byte that tells you XXFD tone set just decoded. It is up to your imagination what you might do/activate with that bit of electronic info.

Sonoff devices have been mentioned in this thread. (Search for them on Amazon). These can be reflashed with alternative firmware arendst/Sonoff-Tasmota that enables the devices to subscribe to mqtt topics on a broker thru wifi. Okay, so now take a Sonoff S20 smart outlet flashed with Tasmota. With that outlet connected to wifi you can turn a light on upon tone activation. Any other of the Sonoff devices can also be controlled similarly. There are also several other “lesser-branded” devices that can be used in the same fashion. Most anything that says it works with the Smart Life app.

I have my MQTT server set up open to the internet. This allows a smart device to subscribe to the mqtt topic from anywhere on the internet. My single pi allows every agency in the county to activate a smart device specific to their tone set. And every FF or EMS member in the county to have a light go on in his home on tone activation if he wishes. It saves fumbling for a light... The “lesser branded” smart outlets are less than $10 each.
https://www.amazon.com/Assistant-Re...ds=Wifi+smart+plug&qid=1551569356&s=hi&sr=1-5

I know that I didn’t specifically answer your question but see if you can digest what I have outlined and come back with any questions if it sounds relevant to your project.

Jim
 
Joined
Oct 23, 2009
Messages
844
Location
Lincoln, NE
I figured it out.
I'm using hass.io
In node-red>input>http
make a subfolder in the node.

Windows make a bat file to open browser/url.

Code:
@echo off
Title Start and Kill Internet Explorer
Mode con cols=75 lines=5 & color 0B
echo(
echo                     Launching Internet Explorer ...
Start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" "http://ip:1880/page"
:: Sleep for 10 seconds, you can change the SleepTime variable
set SleepTime=1
Timeout /T %SleepTime% /NoBreak>NUL
Cls & Color 0C
echo(
echo              Killing Internet Explorer Please wait for a while ...
Taskkill /IM "iexplore.exe" /F
 
Last edited:
Joined
Oct 23, 2009
Messages
844
Location
Lincoln, NE
There’s likely 1000 ways to skin this cat. Thanks to DavidVT, i took a look at node-red and MQTT. Long story short, i have set up an MQTT broker on a pi, TTD publishes a message to it when a tone is decoded through the alert_command parameter.

Jim
Could you help with a step by step to use MQTT? I think I’ve seen a docker for it in unraid or has.io.

I’d like to how set it up so TTD can talk to it then to node-red.

I’m using node-reds http /page and it work. The only issue is if anyone goes to my FQDN/page it will trigger the flow.

I’m using unraid as my server os and w10 vm for TTD. I don’t know if this will be an issue.



Sent from my iPhone using Tapatalk Pro
 
Status
Not open for further replies.
Top