Hey everyone,
I bought and installed this to replace my irrigation system:
I have used the code in the documentation to make it work but I cannot find a way to use the buzzer.
Any ideas?
Hey everyone,
I bought and installed this to replace my irrigation system:
I have used the code in the documentation to make it work but I cannot find a way to use the buzzer.
Any ideas?
Have you read the docs for buzzer?
Thanks, I did but I missed the API part.
Here’s my final code if anybody comes looking:
api:
encryption:
key: !secret api_password
actions:
- action: rtttl_play
variables:
song_str: string
then:
- rtttl.play:
rtttl: !lambda 'return song_str;'
# buzzer
output:
- platform: ledc
pin: GPIO21
id: buzzer
rtttl:
output: buzzer
id: rtttl_buzzer
gain: 50%
on_finished_playback:
- logger.log: 'Song ended!'
Then you go to you can call the song from Actions, in the Developer tools after pasting one of the example lines in the Rttl Buzzer documentation above
This is why its so important to just go to the Esphome website and read the documentation for whichever integrations you’re using.
You only missed part of your shortcut of copy/paste. Again, if you had read the documentation then you would have quickly realized that this api part wasn’t “missed” and it isnt even something that you needed to start with.
I dont know how to emphasize it any harder when i keep repeating the same thing over and over, you gotta read the documentation A.K.A “The Instructions” so that you can find out how to use the RTTTL buzzer.
Here you’ve simply setup and configured an Output
output:
- platform: ledc
pin: GPIO21
id: buzzer
Here, its the same thing except now its your buzzer being setup and configured it to use the Output you setup first.
rtttl:
output: buzzer
id: rtttl_buzzer
gain: 50%
on_finished_playback:
- logger.log: 'Song ended!'
So, you have just defined an Output and the rtttl buzzer that uses that Output (rtttl_buzzer) for playing the buzzer.
Do you notice anything important missing? Or did you ever stop and ask yourself, " what do i use to interface with the buzzer in HA? Neither the Output or the Buzzer were given a name to use in HA so, they wont even show up in HA to start with but, you still have no way to tell the buzzer what to do… This make sense?
If you stop just copying and pasting the very first example code that you find and actually read the documentation, it shows you how to control it!
Those “Configuration Variables” are what you need to setup and they’re pretty self-explanatory as to what they do like…
rtttl.play:
And…
rtttl.stop:
So now you can use whatever action you want inorder to trigger the Play command. You can use a Button, a binary_sensor, a template anything or just set the Play action as your condition in an automation. You have lots of possible ways to use it and doing it up in the api section is IMO the last possible method I would choose to do it.
This stuff isnt that hard dude. You just have to actually make an effort and try instead of expecting people to always do it for you.
I don’t love your tone , but thanks for the write up
Yeah please mind your tone.