Use Siri to Control Wireless Power Outlets (Homebridge)

This is a follow up for my guide on how to control cheap wireless power outlets using a raspberry pi. This is part 1 of a 3 part series on controlling the wireless power outlets using your voice. Part 2 is on Google Home and part 3 covers the Amazon Echo.

With Apple’s Home app, you can control any device that is HomeKit enable from your iOS device. Lucky for us an open source project called HomeBridge was created so we can control the devices from a raspberry pi. HomeBridge is a great open source project that has many plugins and allows you to customize your home automation.

Steps to Setup HomeBridge to control Wireless Power Outlets

  1. Install HomeBridge on your raspberry pi
  2. Setup HomeBridge to start on bootup
  3. Install CmdSwitch2, a plugin for HomeBridge that allows you to execute commands via HomeKit
    1. npm install -g homebridge-cmdswitch2
  4. Edit your HomeBridge config.json file
    1. Type this command to edit your config file.
    2. sudo nano /var/homebridge/config.json
    3. Add this section to the platforms array. Example of my config.json
    4. {
       "platform":"cmdSwitch2",
       "switches":[
         {
           "name":"Lamp",
           "on_cmd":"/var/www/html/rfoutlet/codesend ******",
           "off_cmd":"/var/www/html/rfoutlet/codesend ******"
         }
        ]
      }
    5. Replace the asterisks with your 6 digit code. Verify that /var/www/html/rfoutlet/codesend is the correct path to your codesend executable.
    6. You can add multiple lights just be sure to name them appropriately.
    7. Save and exit (Use “ctrl + x” then “y” to save the file) then restart HomeBridge:
    8. sudo systemctl restart homebridge
    9. Install the Home app on your iOS device.
    10. Connect to the same network as your raspberry pi and you should now see your accessories
    11. Say “Hey Siri, turn on the lamps” or “Turn off the lamps”

 

Here is a guide if you would like to control your lights from when you are away from home. You must have an iPad or Apple Tv to act as your HomeKit hub.

Please leave a comment below if you have any questions.


Also published on Medium.

72 thoughts to “Use Siri to Control Wireless Power Outlets (Homebridge)”

  1. Hi Tim,

    Thank you so much for your guide, it has really inspired me to automate my entire home! This project works perfectly for me! I only had one question which was how would I expand this to work with more than the original 5 RC outlets that I purchased; I.e. If I bought another set of 5 rf outlets, how would I add these to my existing set up? I understand that I would obviously need to add 5 more accessories to the cmd 2 platform in the config.json but I would appreciate if you could give me some guidance as I fear that the rf outlets may use the same codes as the ones I already have which would mean that 2 outlets would be controlled at the same time which is not what I would want. Is there a way to reprogram the new outlets to new codes?

    Thanks once again, Kind regards,

    Tommy

    1. Hey Tommy,
      Glad you got it all working! You can run more than 5 outlets but you may have trouble running 10 unique outlets if they use the same codes as the other 5. Currently, I’m using 7 outlets but I have 2-3 set to the same code and they turn on/off together. I believe someone was able to decode the outlet ids and able to use different codes than the ones that come with the 5 outlets. I couldn’t find the article but someone posted a link to there article in the comments of this article https://timleland.com/wireless-power-outlets/

      1. Hi Tim,
        Thanks for your quick reply! I had a look through the comments on that linked article and couldn’t seem to find the post you were talking about. The only thing I could find were a series of comments which seemed to reference the same comment but had no link. Would you be able to share the link again please?
        Kind regards,
        Tommy

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.