Table of Contents
Add Chacon DI.O remote control support in Domoticz
The idea is to use a 433MHz transmitter connected to an Arduino Uno board to integrate Chacon DI.O wireless power plugs into Domoticz. For an easy integration with Domoticz, we will use MySensors library. Thanks to MySensors, new devices will be automatically detected in Domoticz.
Needed hardware
- Arduino Uno R3 board (available on Amazon) with USB cable
- 433Mhz RF transmitter and receiver (available on eBay)
- DI.O by Chacon power plugs with remote
Assembly
It is very simple. Just connect the RF 433 receiver and transmitter like this:
- GND to Arduino pin GND
- VCC to Arduino pin 5V
- DATA IN (receiver) to Arduino DIGITAL pin 2
- DATA OUT (transmitter) to Arduino DIGITAL pin 11
Then I suppose you have the Arduino connected with a USB cable to a PC running the Arduino development environment.
Find your remote address
To find your remote address, use example sketch “ShowReceivedCode” from “NewRemoteReceiver” library. Then, push remote buttons and you should see address in serial monitor:
Addr 14566078 unit 1 off, period: 272us. Addr 14566078 unit 2 off, period: 272us. Addr 14566078 unit 2 on, period: 272us.
This address must be used in the final sketch to simulate remote.
Arduino sketch
The Arduino program is really simple: it configures MySensors serial gateway, then it presents 3 lights switches and finally, manage commands received from Domoticz by transmitting the command through RF433.
- HomeBox.ino
// Enable debug prints to serial monitor #define MY_DEBUG // Enable serial gateway #define MY_GATEWAY_SERIAL // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) #if F_CPU == 8000000L #define MY_BAUD_RATE 38400 #endif // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 #define MY_NODE_ID 1 #include <MySensors.h> #include <NewRemoteTransmitter.h> /////////////////////////////////////////////////////////////////////////// // Children #define CHILD_ID_DIO_1 0 #define CHILD_ID_DIO_2 1 #define CHILD_ID_DIO_3 2 /////////////////////////////////////////////////////////////////////////// // RF433 emitter #define DIMMER_ADDRESS 14566078 // You should use here the address of your remote #define DIMMER_PIN 11 #define DIMMER_PERIOD 260 NewRemoteTransmitter transmitter(DIMMER_ADDRESS, DIMMER_PIN, DIMMER_PERIOD, 1); void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors present(CHILD_ID_DIO_1, S_LIGHT, "DI.O Prise 1"); present(CHILD_ID_DIO_2, S_LIGHT, "DI.O Prise 2"); present(CHILD_ID_DIO_3, S_LIGHT, "DI.O Prise 3"); } void loop() { // Send locally attached sensor data here } /////////////////////// void receive(const MyMessage &message) { // New status requested for DIO switches if( (message.type == V_STATUS) && (message.destination == getNodeId() ) && (message.sensor >= CHILD_ID_DIO_1) && (message.sensor <= CHILD_ID_DIO_3) ) { transmitter.sendUnit(message.sensor, message.getBool()); } }
Domoticz
In domoticz, add a hardware “MySensors USB Gateway”. Check that serial port is properly configured. Default one should be good in raspberry pi. Then, plug the arduino on the raspberry pi with USB. You should see the detected MySensors gateway on domoticz logs:
2017-01-02 19:21:02.562 MySensors: Using serial port: /dev/ttyACM0 2017-01-02 19:21:04.214 MySensors: Gateway Ready... 2017-01-02 19:21:04.293 (MySensors Gateway USB) Lighting 2 (DI.O Prise 1) 2017-01-02 19:21:04.300 MySensors: Gateway Version: 2.1.0 2017-01-02 19:21:04.299 (MySensors Gateway USB) Lighting 2 (DI.O Prise 2) 2017-01-02 19:21:04.303 (MySensors Gateway USB) Lighting 2 (DI.O Prise 3) 2017-01-02 19:21:08.695 Incoming connection from: 192.168.0.43
And switches are properly detected. You should be able to add them in the devices domoticz view:
Share this page: