Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. 433mhz transmitter

433mhz transmitter

Scheduled Pinned Locked Moved My Project
16 Posts 9 Posters 7.6k Views 9 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dbemowskD Offline
    dbemowskD Offline
    dbemowsk
    wrote on last edited by
    #7

    Just a note for those in the US. The 433 MHz stuff is for European use. Though it would probably work in the US, it is technically not legal according to FCC rules. Here is a version of the transmitters legal for use in the US. This should be a drop in replacement for the 433MHz version, but double check the pins if you do purchase these.

    Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
    Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

    1 Reply Last reply
    0
    • M Matt

      Its kinda kludgy (of course- I made it!) but it works. As usual full of bits pinched from elsewhere....
      I am using this to control 4 effergy wall outlets. I already have mains switching ability but it's made by me and I am nervous about fire, so I figured this was a good compromise.
      I have some cheap 433 transmitters and receivers. Used the RCSwitch library to capture the codes. I have only got one switch functional at the moment but to add the rest is trivial. My coding Im sure is crap but it works.
      I have soldered a wee wire to the transmitter 12CM long and have no issues with range. I like the 'repeat command x times' function in the RCSwitch library, kinda makes not having feedback a non issue.

      // Enable debug prints to serial monitor
      //#define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable repeater functionality for this node
      // #define MY_REPEATER_FEATURE
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <RCSwitch.h>
      
      #define NUMBER_OF_PLUGS 4 // Total number of attached plugs
      
      #define CODE_1On 1290271
      #define CODE_1Off 1290263
      #define CODE_2On 1290267
      #define CODE_2Off 1290259
      #define CODE_3On 1290269
      #define CODE_3Off 1290261
      #define CODE_4On 1290270
      #define CODE_4Off 1290262
      
      RCSwitch mySwitch = RCSwitch();
      
      void setup() {
        mySwitch.enableTransmit(4);
        mySwitch.setRepeatTransmit(15);
      }
      
      void presentation()  
      {   
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("433mhz switch", "1.0");
      
        for (int sensor=1 ; sensor<=NUMBER_OF_PLUGS;sensor++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_LIGHT);
        }
      }
      
      
      void loop() 
      {
        
      }
      
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
        int incomingLightState =  message.getBool(); 
        int incomingOutlet = message.sensor;
        
        Serial.print("Outlet #: ");
        Serial.println(message.sensor);
        Serial.print("Command: ");
        Serial.println(message.getBool());
       
       if (incomingOutlet==1) {
       if (incomingLightState==1) {
          // Turn on  socket 1
          Serial.println("Turn on Socket 1");
       mySwitch.send(CODE_1On, 24); // These codes are unique to each outlet
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 1
       Serial.println("Turn off Socket 1");
      mySwitch.send(CODE_1Off, 24);
      delay(50); 
       }
       }
       if (incomingOutlet==2) {
       if (incomingLightState==1) {
          // Turn on  socket 2
          Serial.println("Turn on Socket 2");
      mySwitch.send(CODE_2On, 24);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 2
       Serial.println("Turn off Socket 2");
      mySwitch.send(CODE_2Off, 24);
      delay(50); 
       }
       }
       if (incomingOutlet==3) {
       if (incomingLightState==1) {
          // Turn on  socket 3
          Serial.println("Turn on Socket 3");
      mySwitch.send(CODE_3On, 24);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 3
       Serial.println("Turn off Socket 3");
      mySwitch.send(CODE_3Off, 24);
      delay(50); 
       }
       }
       if (incomingOutlet==4) {
       if (incomingLightState==1) {
          // Turn on  socket 4
          Serial.println("Turn on Socket 4");
       mySwitch.send(CODE_4On, 24);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 4
       Serial.println("Turn off Socket 4");
      mySwitch.send(CODE_4Off, 24);
      delay(50); 
       }
       }
        }
       delay(50);
      }
      
      
      kchestK Offline
      kchestK Offline
      kchest
      wrote on last edited by
      #8

      @Matt I used your code as a basis to control some 433Mhz outlets from Aldi (in Germany). The system is their "Easy Home" brand, made by Globaltronics. The model designation is GT-9000. It needed a few tweeks from your code. In case anyone else has, or will get, this package, here is the code (pay attention to the "void setup" section):

      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable repeater functionality for this node
      // #define MY_REPEATER_FEATURE
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <RCSwitch.h>
      
      #define NUMBER_OF_PLUGS 4 // Total number of attached plugs
      
      #define CODE_1On "110001010000001101110000"
      #define CODE_1Off "110011011100000100010000"
      #define CODE_2On "110001010000001101110100"
      #define CODE_2Off "110011011100000100010100"
      #define CODE_3On "110001010000001101111100"
      #define CODE_3Off "110011011100000100011100"
      #define CODE_4On "110001010000001101110010"
      #define CODE_4Off "110011011100000100010010"
      
      RCSwitch mySwitch = RCSwitch();
      
      void setup() {
        mySwitch.enableTransmit(4);
        mySwitch.setRepeatTransmit(3);
        mySwitch.setPulseLength(510);
        mySwitch.setProtocol(5);
      }
      
      void presentation()  
      {   
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("433mhz switch", "1.0");
      
        for (int sensor=1 ; sensor<=NUMBER_OF_PLUGS;sensor++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_LIGHT);
        }
      }
      
      
      void loop() 
      {
      }
      
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
        int incomingLightState =  message.getBool(); 
        int incomingOutlet = message.sensor;
        
        Serial.print("Outlet #: ");
        Serial.println(message.sensor);
        Serial.print("Command: ");
        Serial.println(message.getBool());
       
       if (incomingOutlet==1) {
       if (incomingLightState==1) {
          // Turn on  socket 1
          Serial.println("Turn on Socket 1");
       mySwitch.send(CODE_1On); // These codes are unique to each outlet
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 1
       Serial.println("Turn off Socket 1");
      mySwitch.send(CODE_1Off);
      delay(50); 
       }
       }
       if (incomingOutlet==2) {
       if (incomingLightState==1) {
          // Turn on  socket 2
          Serial.println("Turn on Socket 2");
      mySwitch.send(CODE_2On);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 2
       Serial.println("Turn off Socket 2");
      mySwitch.send(CODE_2Off);
      delay(50); 
       }
       }
       if (incomingOutlet==3) {
       if (incomingLightState==1) {
          // Turn on  socket 3
          Serial.println("Turn on Socket 3");
      mySwitch.send(CODE_3On);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 3
       Serial.println("Turn off Socket 3");
      mySwitch.send(CODE_3Off);
      delay(50); 
       }
       }
       if (incomingOutlet==4) {
       if (incomingLightState==1) {
          // Turn on  socket 4
          Serial.println("Turn on Socket 4");
       mySwitch.send(CODE_4On);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 4
       Serial.println("Turn off Socket 4");
      mySwitch.send(CODE_4Off);
      delay(50); 
       }
       }
        }
       delay(50);
      }```
      TheoLT 1 Reply Last reply
      2
      • kchestK kchest

        @Matt I used your code as a basis to control some 433Mhz outlets from Aldi (in Germany). The system is their "Easy Home" brand, made by Globaltronics. The model designation is GT-9000. It needed a few tweeks from your code. In case anyone else has, or will get, this package, here is the code (pay attention to the "void setup" section):

        // Enable debug prints to serial monitor
        #define MY_DEBUG 
        
        // Enable and select radio type attached
        #define MY_RADIO_NRF24
        //#define MY_RADIO_RFM69
        
        // Enable repeater functionality for this node
        // #define MY_REPEATER_FEATURE
        
        #include <SPI.h>
        #include <MySensors.h>
        #include <RCSwitch.h>
        
        #define NUMBER_OF_PLUGS 4 // Total number of attached plugs
        
        #define CODE_1On "110001010000001101110000"
        #define CODE_1Off "110011011100000100010000"
        #define CODE_2On "110001010000001101110100"
        #define CODE_2Off "110011011100000100010100"
        #define CODE_3On "110001010000001101111100"
        #define CODE_3Off "110011011100000100011100"
        #define CODE_4On "110001010000001101110010"
        #define CODE_4Off "110011011100000100010010"
        
        RCSwitch mySwitch = RCSwitch();
        
        void setup() {
          mySwitch.enableTransmit(4);
          mySwitch.setRepeatTransmit(3);
          mySwitch.setPulseLength(510);
          mySwitch.setProtocol(5);
        }
        
        void presentation()  
        {   
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("433mhz switch", "1.0");
        
          for (int sensor=1 ; sensor<=NUMBER_OF_PLUGS;sensor++) {
            // Register all sensors to gw (they will be created as child devices)
            present(sensor, S_LIGHT);
          }
        }
        
        
        void loop() 
        {
        }
        
        void receive(const MyMessage &message) {
          // We only expect one type of message from controller. But we better check anyway.
          if (message.type==V_LIGHT) {
          int incomingLightState =  message.getBool(); 
          int incomingOutlet = message.sensor;
          
          Serial.print("Outlet #: ");
          Serial.println(message.sensor);
          Serial.print("Command: ");
          Serial.println(message.getBool());
         
         if (incomingOutlet==1) {
         if (incomingLightState==1) {
            // Turn on  socket 1
            Serial.println("Turn on Socket 1");
         mySwitch.send(CODE_1On); // These codes are unique to each outlet
         delay(50); 
         }
         if (incomingLightState==0)  {
            // Turn off socket 1
         Serial.println("Turn off Socket 1");
        mySwitch.send(CODE_1Off);
        delay(50); 
         }
         }
         if (incomingOutlet==2) {
         if (incomingLightState==1) {
            // Turn on  socket 2
            Serial.println("Turn on Socket 2");
        mySwitch.send(CODE_2On);
         delay(50); 
         }
         if (incomingLightState==0)  {
            // Turn off socket 2
         Serial.println("Turn off Socket 2");
        mySwitch.send(CODE_2Off);
        delay(50); 
         }
         }
         if (incomingOutlet==3) {
         if (incomingLightState==1) {
            // Turn on  socket 3
            Serial.println("Turn on Socket 3");
        mySwitch.send(CODE_3On);
         delay(50); 
         }
         if (incomingLightState==0)  {
            // Turn off socket 3
         Serial.println("Turn off Socket 3");
        mySwitch.send(CODE_3Off);
        delay(50); 
         }
         }
         if (incomingOutlet==4) {
         if (incomingLightState==1) {
            // Turn on  socket 4
            Serial.println("Turn on Socket 4");
         mySwitch.send(CODE_4On);
         delay(50); 
         }
         if (incomingLightState==0)  {
            // Turn off socket 4
         Serial.println("Turn off Socket 4");
        mySwitch.send(CODE_4Off);
        delay(50); 
         }
         }
          }
         delay(50);
        }```
        TheoLT Online
        TheoLT Online
        TheoL
        Contest Winner
        wrote on last edited by
        #9

        @kchest Great. I have some of those aldi one's laying around doing nothing. Because I couldn't control them with my RFElink. I'll give your sketch a try.

        kchestK 1 Reply Last reply
        0
        • TheoLT TheoL

          @kchest Great. I have some of those aldi one's laying around doing nothing. Because I couldn't control them with my RFElink. I'll give your sketch a try.

          kchestK Offline
          kchestK Offline
          kchest
          wrote on last edited by
          #10

          @TheoL A couple of things to note:
          I hooked up the 433Mhz transmitter to pin 4.
          The device didn't show up under the MySensor section of the Hardware tab. However all 4 plugs appeared in the Devices list. Strange but it works.

          TommiT 1 Reply Last reply
          0
          • kchestK kchest

            @TheoL A couple of things to note:
            I hooked up the 433Mhz transmitter to pin 4.
            The device didn't show up under the MySensor section of the Hardware tab. However all 4 plugs appeared in the Devices list. Strange but it works.

            TommiT Offline
            TommiT Offline
            Tommi
            wrote on last edited by
            #11

            @kchest
            Hello,
            I tried to switch the 433MHZ outlets from the "Intertechno / Brennenstuhl", but unfortunately does not work. I have changed the "pulse length" and the "protocol":

            MySwitch.setPulseLength (320);
            MySwitch.setProtocol (1);

            Do you have any experience with these outlets?

            T 1 Reply Last reply
            0
            • TommiT Tommi

              @kchest
              Hello,
              I tried to switch the 433MHZ outlets from the "Intertechno / Brennenstuhl", but unfortunately does not work. I have changed the "pulse length" and the "protocol":

              MySwitch.setPulseLength (320);
              MySwitch.setProtocol (1);

              Do you have any experience with these outlets?

              T Offline
              T Offline
              TimO
              Hero Member
              wrote on last edited by
              #12

              @Tommi I've outlets from Intertechno (IT-1500) running fine for over a year now.

              The outlets have to learn the code, so shortly after pluggin in, when the led on the outlet blinks, send an ON from your MySensors node.

              Here is my sketch (its a combination of DHT22, 12V LED/PWM Switch and 433 MHz node):

              #define MY_DEFAULT_RX_LED_PIN 7
              #define MY_DEFAULT_TX_LED_PIN 6
              #define MY_DEFAULT_ERR_LED_PIN 4
              
              #define MY_RADIO_NRF24
              
              #define MY_NODE_ID 106
              
              // Enabled repeater feature for this node
              #define MY_REPEATER_FEATURE
              
              
              //#define MY_DEBUG
              
              #include <SPI.h>
              #include <MySensors.h>  
              #include <DHT.h>
              #include "RCSwitch.h"
              
              #define CHILD_ID_HUM 0
              #define CHILD_ID_TEMP 1
              #define CHILD_ID_PWM_LIGHT 3
              #define CHILD_ID_433_1 4
              #define CHILD_ID_433_2 5
              #define CHILD_ID_433_3 6
              #define CHILD_ID_433_4 7
              #define CHILD_ID_433_5 8
              #define CHILD_ID_433_6 9
              
              
              #define HUMIDITY_SENSOR_DIGITAL_PIN 8
              #define PWM_LIGHT_PIN 5
              
              unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
              unsigned long NEXT_CHECK = 0;
              
              DHT dht;
              float lastTemp;
              float lastHum;
              boolean metric = true;
              RCSwitch mySwitch = RCSwitch(); 
              MyMessage msgHum(CHILD_ID_HUM, V_HUM);
              MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
              MyMessage msgPWM(CHILD_ID_PWM_LIGHT, V_STATUS);
              
              
              void setup()  
              { 
                dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
              
                pinMode(PWM_LIGHT_PIN, OUTPUT);
                digitalWrite(PWM_LIGHT_PIN, LOW);
                
                mySwitch.enableTransmit(A0);
              }
              
              void presentation() {
                // Send the Sketch Version Information to the Gateway
                sendSketchInfo("GuestCombiSensor", "2.0");
              
                // Register all sensors to gw (they will be created as child devices)
                present(CHILD_ID_HUM, S_HUM);
                present(CHILD_ID_TEMP, S_TEMP);
                present(CHILD_ID_PWM_LIGHT, S_LIGHT);
                present(CHILD_ID_433_1, S_LIGHT);
                present(CHILD_ID_433_2, S_LIGHT);
                present(CHILD_ID_433_3, S_LIGHT);
                present(CHILD_ID_433_4, S_LIGHT);
                present(CHILD_ID_433_5, S_LIGHT);
                present(CHILD_ID_433_6, S_LIGHT);
                
                metric = getConfig().isMetric;
              }
              
              void loop()      
              {   
               readDHT();
               wait(SLEEP_TIME); 
              }
              
              void readDHT() {
                float temperature = dht.getTemperature();
                if (isnan(temperature)) {
                    Serial.println("Failed reading temperature from DHT");
                } else if (temperature != lastTemp) {
                  lastTemp = temperature;
                  if (!metric) {
                    temperature = dht.toFahrenheit(temperature);
                  }
                  send(msgTemp.set(temperature, 1));
                  Serial.print("T: ");
                  Serial.println(temperature);
                }
                
                float humidity = dht.getHumidity();
                if (isnan(humidity)) {
                    Serial.println("Failed reading humidity from DHT");
                } else if (humidity != lastHum) {
                    lastHum = humidity;
                    send(msgHum.set(humidity, 1));
                    Serial.print("H: ");
                    Serial.println(humidity);
                }
              }
              
              void changeSwitchStatus(char familyCode, int group, int device, bool status, int retries) {
                for(int i = 0; i < retries; i++) {
                  if(status) {
                    mySwitch.switchOn(familyCode, group, device);
                  } else {
                    mySwitch.switchOff(familyCode, group, device);
                  }
                  wait(50);
                }
              }
              
              void receive(const MyMessage &message) {
                // We only expect one type of message from controller. But we better check anyway.
                if (message.type==V_LIGHT) {
                   if(message.sensor==CHILD_ID_PWM_LIGHT) {
                      if(message.getBool())
                        digitalWrite(PWM_LIGHT_PIN, HIGH);
                      else
                        digitalWrite(PWM_LIGHT_PIN, LOW);
                   } else if(message.sensor==CHILD_ID_433_1) {
                      changeSwitchStatus('a', 1, 1, message.getBool(), 3);
                   } else if(message.sensor==CHILD_ID_433_2) {
                      changeSwitchStatus('a', 1, 2, message.getBool(), 3);
                   } else if(message.sensor==CHILD_ID_433_3) {
                      changeSwitchStatus('a', 1, 3, message.getBool(), 3);
                   } else if(message.sensor==CHILD_ID_433_4) {
                      changeSwitchStatus('a', 2, 1, message.getBool(), 3);
                   } else if(message.sensor==CHILD_ID_433_5) {
                      changeSwitchStatus('a', 2, 2, message.getBool(), 3);
                   } else if(message.sensor==CHILD_ID_433_6) {
                      changeSwitchStatus('a', 2, 3, message.getBool(), 3);
                   }
                 } 
              }
              

              I'm pretty amazed on how well this setup works. My wife and I use it daily and I've a scheduled task that switches on an outlet daily. Works like a charm.

              Only limitation: If you send commands too fast, for example switch on outlet 1 & 2 at the same time the outlets get confused. :-) Often outlet 3 gets switched on too in that case. Maybe it has something to do with the 3 retries I'm using.

              TommiT 1 Reply Last reply
              0
              • T TimO

                @Tommi I've outlets from Intertechno (IT-1500) running fine for over a year now.

                The outlets have to learn the code, so shortly after pluggin in, when the led on the outlet blinks, send an ON from your MySensors node.

                Here is my sketch (its a combination of DHT22, 12V LED/PWM Switch and 433 MHz node):

                #define MY_DEFAULT_RX_LED_PIN 7
                #define MY_DEFAULT_TX_LED_PIN 6
                #define MY_DEFAULT_ERR_LED_PIN 4
                
                #define MY_RADIO_NRF24
                
                #define MY_NODE_ID 106
                
                // Enabled repeater feature for this node
                #define MY_REPEATER_FEATURE
                
                
                //#define MY_DEBUG
                
                #include <SPI.h>
                #include <MySensors.h>  
                #include <DHT.h>
                #include "RCSwitch.h"
                
                #define CHILD_ID_HUM 0
                #define CHILD_ID_TEMP 1
                #define CHILD_ID_PWM_LIGHT 3
                #define CHILD_ID_433_1 4
                #define CHILD_ID_433_2 5
                #define CHILD_ID_433_3 6
                #define CHILD_ID_433_4 7
                #define CHILD_ID_433_5 8
                #define CHILD_ID_433_6 9
                
                
                #define HUMIDITY_SENSOR_DIGITAL_PIN 8
                #define PWM_LIGHT_PIN 5
                
                unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                unsigned long NEXT_CHECK = 0;
                
                DHT dht;
                float lastTemp;
                float lastHum;
                boolean metric = true;
                RCSwitch mySwitch = RCSwitch(); 
                MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                MyMessage msgPWM(CHILD_ID_PWM_LIGHT, V_STATUS);
                
                
                void setup()  
                { 
                  dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
                
                  pinMode(PWM_LIGHT_PIN, OUTPUT);
                  digitalWrite(PWM_LIGHT_PIN, LOW);
                  
                  mySwitch.enableTransmit(A0);
                }
                
                void presentation() {
                  // Send the Sketch Version Information to the Gateway
                  sendSketchInfo("GuestCombiSensor", "2.0");
                
                  // Register all sensors to gw (they will be created as child devices)
                  present(CHILD_ID_HUM, S_HUM);
                  present(CHILD_ID_TEMP, S_TEMP);
                  present(CHILD_ID_PWM_LIGHT, S_LIGHT);
                  present(CHILD_ID_433_1, S_LIGHT);
                  present(CHILD_ID_433_2, S_LIGHT);
                  present(CHILD_ID_433_3, S_LIGHT);
                  present(CHILD_ID_433_4, S_LIGHT);
                  present(CHILD_ID_433_5, S_LIGHT);
                  present(CHILD_ID_433_6, S_LIGHT);
                  
                  metric = getConfig().isMetric;
                }
                
                void loop()      
                {   
                 readDHT();
                 wait(SLEEP_TIME); 
                }
                
                void readDHT() {
                  float temperature = dht.getTemperature();
                  if (isnan(temperature)) {
                      Serial.println("Failed reading temperature from DHT");
                  } else if (temperature != lastTemp) {
                    lastTemp = temperature;
                    if (!metric) {
                      temperature = dht.toFahrenheit(temperature);
                    }
                    send(msgTemp.set(temperature, 1));
                    Serial.print("T: ");
                    Serial.println(temperature);
                  }
                  
                  float humidity = dht.getHumidity();
                  if (isnan(humidity)) {
                      Serial.println("Failed reading humidity from DHT");
                  } else if (humidity != lastHum) {
                      lastHum = humidity;
                      send(msgHum.set(humidity, 1));
                      Serial.print("H: ");
                      Serial.println(humidity);
                  }
                }
                
                void changeSwitchStatus(char familyCode, int group, int device, bool status, int retries) {
                  for(int i = 0; i < retries; i++) {
                    if(status) {
                      mySwitch.switchOn(familyCode, group, device);
                    } else {
                      mySwitch.switchOff(familyCode, group, device);
                    }
                    wait(50);
                  }
                }
                
                void receive(const MyMessage &message) {
                  // We only expect one type of message from controller. But we better check anyway.
                  if (message.type==V_LIGHT) {
                     if(message.sensor==CHILD_ID_PWM_LIGHT) {
                        if(message.getBool())
                          digitalWrite(PWM_LIGHT_PIN, HIGH);
                        else
                          digitalWrite(PWM_LIGHT_PIN, LOW);
                     } else if(message.sensor==CHILD_ID_433_1) {
                        changeSwitchStatus('a', 1, 1, message.getBool(), 3);
                     } else if(message.sensor==CHILD_ID_433_2) {
                        changeSwitchStatus('a', 1, 2, message.getBool(), 3);
                     } else if(message.sensor==CHILD_ID_433_3) {
                        changeSwitchStatus('a', 1, 3, message.getBool(), 3);
                     } else if(message.sensor==CHILD_ID_433_4) {
                        changeSwitchStatus('a', 2, 1, message.getBool(), 3);
                     } else if(message.sensor==CHILD_ID_433_5) {
                        changeSwitchStatus('a', 2, 2, message.getBool(), 3);
                     } else if(message.sensor==CHILD_ID_433_6) {
                        changeSwitchStatus('a', 2, 3, message.getBool(), 3);
                     }
                   } 
                }
                

                I'm pretty amazed on how well this setup works. My wife and I use it daily and I've a scheduled task that switches on an outlet daily. Works like a charm.

                Only limitation: If you send commands too fast, for example switch on outlet 1 & 2 at the same time the outlets get confused. :-) Often outlet 3 gets switched on too in that case. Maybe it has something to do with the 3 retries I'm using.

                TommiT Offline
                TommiT Offline
                Tommi
                wrote on last edited by
                #13

                @TimO
                Many thanks for your response !
                I have only the 433MHZ transmitter connected without DHT22 and LEDs, but it does not work unfortunately, I do not know what I doing wrong !?
                Shortly after the plug in, while the LED still flashes I do in FHEM "set MYSENSOR_xy status1 on" but without success.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  TimO
                  Hero Member
                  wrote on last edited by
                  #14

                  Did you verify that the message is received by the node?
                  I'm not familiar with FHEM, please note, that the first outlet uses child ID 4.
                  What's the debug output of the node?

                  1 Reply Last reply
                  0
                  • TommiT Offline
                    TommiT Offline
                    Tommi
                    wrote on last edited by
                    #15
                    This post is deleted!
                    TommiT 1 Reply Last reply
                    0
                    • TommiT Tommi

                      This post is deleted!

                      TommiT Offline
                      TommiT Offline
                      Tommi
                      wrote on last edited by
                      #16
                      This post is deleted!
                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      22

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular