Coder Social home page Coder Social logo

rpi-announce's Introduction

RPI-Announce

This is a hastily written script to create an announcement queue for the Raspberry Pi. The specific purpose was to use in conjunction with OpenHab to queue announcements to make throughout the house. This code is not polished at all, but is functional.

WARNING: this is not even close to being secure. The script runs as root and is almost guaranteed to be vulnerable to command injection I have my Raspberry Pi setup on a separate, firewalled VLAN, so only the automation controller can access it directly.

Raspberry Pi Setup

I have a 2 relay board with relay control on pins 24 and 25 for zones A and B. I have an amplifier plugged into the output of a USB audio adapter on the Pi. The left output of the amp is split and routed through both of the relays and then speakers are hooked up to the relay output to create the zones.

Example 1 (Creating an announcement)

http://rpi-announce:8084/?type=sound&message=wx_alert&times=1&volume=5&priority=200&id=wx&zone=B

Where:

  • type is the set to "sound" to play a pre-recorded .wav file from /var/sounds/ (type is there with the idea that text to speech might be available in the future)
  • message is the name of the .wav file to play from /var/sounds/ (in this case, wx_alert.wav)
  • times is the amount of times to play the announcement (if times is 0, the announcement will loop until it is stopped with a stop command)
  • volume is the volume to set the Pis volume to while playing the announcement
  • priority defines the order the announcements will be played (lower numbers first) if there are multiple in queue
  • id is only really used for times=0 announcements so that it can be referenced to stop it (but it is always required)
  • zone is the zone to play it in. My relays are set to A is outside, B is inside, and C is all zones

Example 2 (Stopping a looping announcement)

http://rpi-announce:8084/?id=wx

This will stop a continuously looping (times=0) announcment with id of wx

Running on startup

I added

/usr/bin/python3 /home/pi/AnnouncementSystem.py &

to rc.local on the Pi right before the exit 0

rpi-announce's People

Contributors

kq9914 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.