PHP-Chacon: Tools to control Chacon WIFI Plug (53012)

Published on 2021-11-14. Updated on 2022-01-30.

These scripts are the result of reverse engineering of Chacon WIFI socket network communication.

PHP-Chacon is a set of scripts written in PHP for use with the Chacon WIFI socket from a Linux system. They are not a full implementation of the features in the Chacon Home application yet, but they are enough to turn ON/OFF the sockets and help to implement a web interface.

The toolkit consists of 3 scripts, each with a specific destination.

chacon_wifi_controller.php     - Turn ON or OFF the socket.
chacon_state.php               - Save the status of the socket in a file for use with a web interface.
chacon_packet_decryption.php   - Displays details about encrypted packages.


Example of installation on RaspberryPI OS 10 (buster) with PHP 7.3 :

# apt-get -y install php-pear php7.3-dev php7.3-mbstring libmcrypt-dev libreadline-dev
# pecl channel-update	
# pecl install mcrypt-1.0.4   (Check for latest version at
# bash -c "echo extension=/usr/lib/php/20180731/ > /etc/php/7.3/cli/conf.d/mcrypt.ini"

Be sure of the version by checking the site above. Also be sure that the date of the last command (20180731) may be different.


Before using the scripts the following must be done:


/etc/ethers is not required because the script will find the MAC address if it is not in /etc/ethers, but it is preferable.
The scripts will work best if they are in the same WLAN with the sockets, such as on a raspberry pi.

1. chacon_wifi_controller.php. Pretty self explanatory.

Usage: 	chacon_wifi_controller.php IP | cmd (on|off|state)

IP      - IP address of the socket.
on      - Start the socket.
off     - Stop the socket.
state   - Get the current state of the socket.

2. chacon_packet_decryption.php. Pretty self explanatory.

# ./chacon_packet_decryption.php 
Usage: 	chacon_packet_decryption.php encoded_packet

Usefull to find your company code + device type + auth code.

3. chacon_state.php.

#./chacon_state.php -h
Usage: 	chacon_state.php (-s | -v)

-s      - Silent mode.
-v      - Verbose mode.

Can be used from CLI (when needed) but can also be used with crontab (in the event of a web interface and especially for statistics). The default behavior is to report the state of the socket to stdout and at the same time to add an entry in the logs/ directory. It will also create a /tmp/ip_address.status file containing 1 (ON) or 0 (OFF).

In verbose mode it will throw more information about the response received from the socket.

In silent mode it adds only log entries, nothing to stdout.

If you want to use with crontab, add an entry like below:

@reboot   cd install_dir; ./chacon_state -s


See Downloads page.


Try reading the FAQ and if you can't find the answer, send an email.


BSD 2-Clause "Simplified" License.
See LICENSE or for the full license text.