Skip to content

Optimize tagreader.yaml#9

Merged
magnusoverli merged 4 commits intoadonno:masterfrom
jesserockz:patch-1
Sep 17, 2020
Merged

Optimize tagreader.yaml#9
magnusoverli merged 4 commits intoadonno:masterfrom
jesserockz:patch-1

Conversation

@jesserockz
Copy link
Copy Markdown
Collaborator

@jesserockz jesserockz commented Sep 17, 2020

  • remove the unneeded globals to use the template switches directly
  • switch on_loop to on_boot as it was only ever run once

@magnusoverli
Copy link
Copy Markdown
Collaborator

magnusoverli commented Sep 17, 2020

Currently we are using an active version of the buzzer, making us unable to use the new rtttl component in ESPhome as this requires a passive buzzer.
Switching to on_boot is a good idea!

@jesserockz
Copy link
Copy Markdown
Collaborator Author

Ah, I did not notice the active buzzer. Have reverted that part of the code

@jesserockz
Copy link
Copy Markdown
Collaborator Author

But also:

- output.esp8266_pwm.set_frequency:
    id: buzzer
    frequency: 500hz
- output.set_level:
    id: buzzer
    level: 50%

Is exactly what the rtttl component does per note...

output_->update_frequency(freq);
output_->set_level(0.5);

I don't have an active buzzer to try it, maybe it will work with the buzzer you are using?

@jesserockz
Copy link
Copy Markdown
Collaborator Author

If the current code is working to change the tone of the buzzer for the 3 beeps, then it must be a passive buzzer and not an active one. I don't believe active buzzers can change tone.
If it is active and just beeps the same every time then you just need a switch to turn the gpio pin on and off and not the pwm control.

@adonno
Copy link
Copy Markdown
Owner

adonno commented Sep 17, 2020

If the current code is working to change the tone of the buzzer for the 3 beeps, then it must be a passive buzzer and not an active one. I don't believe active buzzers can change tone.
If it is active and just beeps the same every time then you just need a switch to turn the gpio pin on and off and not the pwm control.

I will try that out as soon as I get home. I hope it works, it would allow for a cleaner yaml

@jesserockz
Copy link
Copy Markdown
Collaborator Author

Awesome. Sleep time for me, but I pushed the rtttl version to another branch

@magnusoverli magnusoverli merged commit 775955b into adonno:master Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants