Learning 433 mhz with Domoticz



  • Bit of a newbie question.

    I have my mysensors gateway talking to Domoticzc. I also have a lot of old 433 mhz switches and sockets around the place I want to use. Now I have been doing a lot of reading in the forums working out how to get my 433 mhz gear talking to domoticz via the gateway and a lot of the posts discuss learning the codes sent bu the 433 gear.

    My question is, in domoticz, with the switches, they have a learning mode for the switch that listens to incomming signals. If everything is setup OK, can this function be used once basic connectivity is made with the 433 gear and the gateway? If you could point me to the best posts on the subject I will dig further.



  • I have several 433 switches which also have the 'learn code' button. I used the remote to set the codes, sniffed the codes and then put those codes into the sketch on arduino 433 gateway. I do not use the remote after programming the switches. My brand of switches can store three different commands for both off and on. I have used this feature to improve (?) speed and synchronization of multiple switch actuation.

    I do not see how the controller (my case is Vera) could utilize this 'learning' feature. Is there something you had in mind?



  • Learning in Domoticz is for RFXCom transceiver, which is expensive.
    Do your own coding with arduino libraries (i.e. new remote switch) and code it with i.e. script.



  • I may have misinterpreted @diggs question. I am not familiar with Domoticz. I use Vera which also has a plugin for using the RFXCom equipment but the expense drove me to use MySensors for my 433 switches.

    I used the 433Mhz transmitter on a mains powered nano and use the relay sketch to control my 433Mhz outlets.



  • BOYS COMBINE FORCES, participate on
    http://forum.mysensors.org/topic/1557/combined-mysensor-gateway-with-433mhz-transmitter-homeeasy-klik-aan-klik-uit/11 because it seems to have been settled in part

    /**
     * Import the libraries needed by the Sketch
     */
    #include <MySensor.h>  
    #include <SPI.h>
    #include <RemoteTransmitter.h>
     
    /**
     * Declare constants like pin settings etc.
     */
    #define TRANSMITTERPIN 6 // documentation doesn't see anything if the needs to be a PWM, but why take the risk?
    #define CHILD_ID_ACTION_SWITCH_A 1 // Declare the DEVICE A as a separate switch
    #define CHILD_ID_ACTION_SWITCH_B 2 // Declare the DEVICE B as a separate switch -- In my situation I configured all outlet's as DEVICE A, so reserved for future useage 
    #define CHILD_ID_ACTION_SWITCH_C 3 // Declare the DEVICE B as a separate switch -- In my situation I configured all outlet's as DEVICE A, so reserved for future useage 
    #define CHILD_ID_ACTION_SWITCH_D 4 // Declare the DEVICE B as a separate switch -- In my situation I configured all outlet's as DEVICE A, so reserved for future useage 
    #define CHILD_ID_ACTION_SWITCH_E 5 // Declare the DEVICE B as a separate switch -- In my situation I configured all outlet's as DEVICE A, so reserved for future useage 
    const char SYSTEMCODE = char(31); // cast the integer byte value to a char should do the trick. Adjust this to your own SYSTEMCODE see RemoteTransmitter.h
     
    /*
     * Declare variables
     */
    ActionTransmitter switchTransmitter = ActionTransmitter( TRANSMITTERPIN ); 
    unsigned long SLEEP_TIME = 5000; // the main loop will probably won't do a thing if we only attach a transmitter.
    MySensor gw;
     
    /*
     * Declare MySensors Messages
     */
    MyMessage msgDeviceA( CHILD_ID_ACTION_SWITCH_A, V_LIGHT );
    MyMessage msgDeviceB( CHILD_ID_ACTION_SWITCH_B, V_LIGHT );
    MyMessage msgDeviceC( CHILD_ID_ACTION_SWITCH_C, V_LIGHT );
    MyMessage msgDeviceD( CHILD_ID_ACTION_SWITCH_D, V_LIGHT );
    MyMessage msgDeviceE( CHILD_ID_ACTION_SWITCH_E, V_LIGHT );
    
    /**
     * Preparation code during initialization of the Arduino
     */
    void setup() {
      // put your setup code here, to run once:
      // Serial.begin( 115200 );
      gw.begin( incomingMessage ); // attach a message handler for handling commands transmitted by the controller.
    
      gw.sendSketchInfo("433Mhz bridge", "1.0");       // Send the sketch version information to the gateway and Controller
      gw.present( CHILD_ID_ACTION_SWITCH_A, S_LIGHT ); // Present Device A to the gateway
      gw.present( CHILD_ID_ACTION_SWITCH_B, S_LIGHT ); // Present Device B to the gateway
      gw.present( CHILD_ID_ACTION_SWITCH_C, S_LIGHT ); // Present Device C to the gateway
      gw.present( CHILD_ID_ACTION_SWITCH_D, S_LIGHT ); // Present Device D to the gateway
      gw.present( CHILD_ID_ACTION_SWITCH_E, S_LIGHT ); // Present Device E to the gateway
      
      gw.sendBatteryLevel(100); // It just looks better in Domoticz if we let Domoticz no we're running on 100% power.
    
    }
    
    /**
     * The Sketch's main loop.
     */
    void loop() {
      // I have nothing to do if only attach a transmitter. 
      gw.wait( SLEEP_TIME ); // call the wait routine, which will allow for incomming messages during the waiting
    }
    
    void incomingMessage(const MyMessage &message) {
      Serial.println("message");
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_LIGHT) {
        char device = 64 + message.sensor; // translate child id to device ID. A = 65 so if we take off one and add the received sensor ID we get the correct device
      //  Serial.println( "Command received for Device " + (String)device + " on id " + (String)message.sensor + " request to turn " + (message.getBool()?"on":"off") );
        if ( device >= 'A' && device <= 'E' ) { // Impuls/Action system only allows device 'A' to 'E'
          switchTransmitter.sendSignal(SYSTEMCODE, device, message.getBool() );
        }
      }
    }```

Log in to reply
 

Suggested Topics

  • 5
  • 2
  • 5
  • 5
  • 1
  • 4

7
Online

11.4k
Users

11.1k
Topics

112.7k
Posts