Skip to content

This Python script transforms standard remote-controlled lights to smart lights.

License

Notifications You must be signed in to change notification settings

xtai/py-rf-lights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-rf-lights

This Python script transforms standard remote-controlled lights to smart lights. You can add these lights to the Apple Home app via this Homebridge plug-in.

cover

Features

  • Manage multiple lights using a extensible framework.
  • Store lights status using JSON files.
  • Control the brightness of the entire light or individual components.
  • Emulate the remote control.

Script Usage

Control power:

  • python control.py --light hana --on
  • python control.py --light hana --off

Control brightness:

  • python control.py --light hana --brightness 100
  • python control.py --light hana --brightness 10

Control a part of light:

  • python control.py --light tao --part top --on
  • python control.py --light tao --part top --brightness 50
  • python control.py --light tao --part top --off

Sync:

Sometimes a command might not be able to regester due to transimitting issues or interference, this command will re-sync the light status to on and 100% brightness.

  • python control.py --light hana --sync

Emulate a remote button click:

  • python remote.py --light tao --button a
  • python remote.py --light hana --button a

Emulate the default remote button hold:

  • python remote.py --light tao --button b --hold

Emulate a custom repeat for remote button:

  • python remote.py --light hana --button c --repeat 60

How does it work?

Remote

remote

Some lights are controlled by a remote using radio frequency, often 433 MHz.

Learn

learn

To emulate the remote, decoding its communication is the first step. This tutorial from george7378 shows how to do this with a Raspberry Pi and a 433 MHz receiver.

Below are three example lights with their remote controller radio wave patterns and button codes decoded.

Control

run

After decoding the remote signal, we can replicate the button click. However, to make the light smart, we also need to track its status and integrate a generic interface for smart home frameworks like Homebridge. This means we have to figure out the necessary button clicks according to the light model and its current and target state, then transmit the sequences.

The logic for the example lights below can be found in the [light_name].py files within the light folder.

Example Lights

Light Hana

Light Hana

Amazon: https://www.amazon.com/dp/B0CDGF12NR/

Light Tao

Light Tao

Amazon: https://www.amazon.com/dp/B0CQ7HY8VQ/

Light Tx

Light Tx

Amazon: https://www.amazon.com/dp/B08M95NB7B/

Acknowledgments

About

This Python script transforms standard remote-controlled lights to smart lights.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages