This project is a set of PHP Classes working with libcoap's coap-client to allow controlling IKEA's Trådfri smart lighting products. For this, coap-client is used to communicate with the Trådfri Gateway through COAP over TLS.
- Querying a list of the following items configured in the gateway:
- Devices
- Lamps
- Remote Controls
- Motion Sensors
- Groups
- Devices
- Querying the status of the items
- On/Off
- Brightness
- Battery level
- Names
- Turning lights and groups on and off
- Gateway Functions
- Querying the Status informations
- Reboot
- IKEA Trådfri Gateway
- PHP7 (with minor adjustments older versions can also be used)
- libcoap (only supports Linux unfortunately)
- Install coap-client with DTLS support. Preferrably, debug output from tinydtls should be disabled (otherwise adjustments in the scripts are required, see inside list.php for details on this). The script install-coap-client.sh from the pytradfri repository automates this.
- Place the scripts in a web server directory accessible to web browsers. Ensure executing processes on the command line is allowed in your PHP installation.
While creating an object in your code, you must provide the parameters for user, secretkey and IP Address Example:
$groups = new tradfrigroups("<user>", "<secret>", "<ip>");