User Tools

Site Tools


add_chacon_di.o_remote_control_support_in_domoticz

This is an old revision of the document!


Add Chacon DI.O remote control support in Domoticz

Page under construction

I use a 433MHz emitter connected to a Arduino Uno board to integrate Chacon DI.O wireless power plugs into Domoticz.

Arduino sketch

HomeBox.ino
// Uses MySensors library for easy integration with Domoticz
 
// Enable debug prints to serial monitor
#define MY_DEBUG
 
// Set LOW transmit power level as default, if you have an amplified NRF-module and
// power your radio separately with a good regulator you can turn up PA level.
#define MY_RF24_PA_LEVEL RF24_PA_LOW
 
// 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
#define DIMMER_PIN 11
#define DIMMER_PERIOD 260
NewRemoteTransmitter transmitter(DIMMER_ADDRESS, DIMMER_PIN, DIMMER_PERIOD, 0);
 
void setup()
{
  // Setup locally attached sensors
}
 
void presentation()
{
  // Present locally attached sensors
  present(CHILD_ID_DIO_1, S_LIGHT);
  present(CHILD_ID_DIO_2, S_LIGHT);
  present(CHILD_ID_DIO_3, S_LIGHT);
}
 
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 >= CHILD_ID_DIO_1) 
      && (message.destination <= CHILD_ID_DIO_3) ) {
    transmitter.sendUnit(message.destination, message.getBool()); 
  }
}
add_chacon_di.o_remote_control_support_in_domoticz.1483303635.txt.gz · Last modified: 2017/01/01 21:47 by sgripon