RTTTL Repeat

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
fbnts
Normal user
Posts: 1
Joined: 08 Jan 2019, 21:48

RTTTL Repeat

#1 Post by fbnts » 08 Jan 2019, 21:53

Hi,

I'm using ESPEasy with Home Assistant and have a buzzer hooked up and I currently use MQTT to play a tone with PWM. I want to actually use RTTTL so it's not just a continuous droning tone. Is there a way to repeat the sequence until a send MQTT message is received to stop? I want to create a sort of siren/two tone alarm for one condition (Side gate being left open too long etc). I suppose I could just repeat the RTTTL sequence multiple times and then every X second get Home Assistant to re-send the MQTT to start it again but that's not really the most efficient way to do it.

Thanks

Tom

User avatar
grovkillen
Normal user
Posts: 2837
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: RTTTL Repeat

#2 Post by grovkillen » 08 Jan 2019, 22:30

Yes, using rules (with timer).

Code: Select all

On PlayTune Do
  RTTTL,14,test:d=8,o=5,b=180,c6,b,c6,p,g,g-
  TimerSet,1,2  //will play again in two seconds
EndOn

On StopTune Do
  TimerSet,1,0 //disable timer
EndOn

On Rules#Timer=1 Do
  Event,PlayTune
EndOn
You then use the commands Event,PlayTune or Event,StopTune to start and stop the tune.

PS. Remember that RTTTL is blocking, meaning that the unit will play the tune from start till end. It will not be responding to any commands during this time.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests