Skip to content

sweisss/rpi-smart-hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspberry Pi Smart Hub

This project uses a Raspberry Pi 3 as a smart hub for dumb lights.

A more detailed writeup of the project can be found at: https://sweisss.github.io/projects/smarthubfordumblights.html

Setup

The only files from this repository that need to actually be cloned to the Raspberry Pi are devices.json and rf_transmit.py. The data from flows_vx.json can be imported to Node-RED via copy and paste. For more information on how to do this, see the official Node-RED documentation.

Discord Integration

After importing the flow to Node-RED, be sure to install node-red-contrib-discord 5.0.0 from the Manage palatte.

Replace the "Token" entry value of the Discord node with the token of your bot.

image

Alternatively, save the token under the name DISCORD_TOKEN at the top of your settings.js file located in /home/raspberry/.node-red. The line should look like the following:

process.env.DISCORD_TOKEN = '<token>'

After setting up the Discord server, be sure to update the channel ids in devices.json.

eWeLink Integration

To control a smart switch using the eWeLink API:

  1. Log in to https://web.ewelink.cc/
  2. Get the bearer token from developer tools
    • Right-click anywhere on the web application and select "Inspect"
    • Go to the Network tab and refresh the page
    • Some of the files, including profile, my-scene, and query, will display the Bearer Token in the Request Headers
    • NOTE: The token will refresh after logging in on a different device.
  3. Add the device id to settings.js with the name PORCHSWITCH_ID, similar to the DISCORD_TOKEN, and reference it from an environment variable in the "Set HTTP POST headers and body" node.
  4. Add the bearer token to a file named token.txt adjacent to the rf_transmit.py script. Update the file paths in the readToken and writeToken nodes if necessary.

Python Script

Be sure to update the exec node with the correct location of the python script on your system.

About

Using a Raspberry Pi as a smart hub for dumb lights.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages