SIP-based Smart Plug Controller for Raspberry Pi. Spiritual successor to SIP-Pi, remade from the ground up.
Can be modified to support other types of smart plugs or displays.
Currently in development. Expect breaking changes.
- Raspberry Pi (tested on Pi 4 Model B) or other device capable of Python and PJSIP
- EZPlug v2 or other smart plug with open API
- PiOLED or other display (optional)
- Any appliance you want to control, such as a microwave with a mechanical timer
- A SIP account, such as a free Telnyx account
- Configure and build PJSIP with the
-fPICflag. - Clone the repository.
git clone https://github.com/KawaiiFiveO/PhoneWave.git
cd PhoneWave
- Create a virtual environment.
python -m venv sipenv
source sipenv/bin/activate
- Install SWIG.
sudo apt-get install swig
- In the
pjprojectdirectory, build and install PJSUA2 for Python. Make sure you are in the virtual environment when running theinstallcommand.
cd pjsip-apps/src/swig/python
make
python setup.py install
- Back in the
PhoneWavedirectory, copy the config file and edit it with your values.
cp config.example config.py
nano config.py
You can also change audio/welcome.wav to any message of your choice.
- Install requirements.
pip install -r requirements.txt
- Run the program.
python main.py
- From your phone, call the phone number of the SIP client. You will hear
welcome.wav. - Enter a time in seconds and press
#to turn the plug on for that period of time.
- Add safety checks/handle edge cases
- Method to run the program in the background or as a service
- Improve display aesthetics