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. Development
  3. setup ir sensor with domoticz !

setup ir sensor with domoticz !

Scheduled Pinned Locked Moved Development
18 Posts 4 Posters 12.6k Views 6 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.
  • AWIA AWI

    @Reza The sketch you are using is a simple switch with the ir hex value hardcoded. You can rework it to a V_DIMMER and have it sent a few hardcoded values. The part below shows that the switch (V_LIGHT) sends the "Volume up" (0x1EE17887) code when switched on and the "Volume down" (0x1EE1F807) code when set to off.

    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 incomingRelayStatus = message.getInt();
         if (incomingRelayStatus == 1) {
          irsend.send(NEC, 0x1EE17887, 32); // Vol up yamaha ysp-900
         } else {
          irsend.send(NEC, 0x1EE1F807, 32); // Vol down yamaha ysp-900
         }
         // Start receiving ir again...
        irrecv.enableIRIn(); 
      }
    }
    

    I can think of a few other options with V_TEXT but that would skip the first part of your learning curve ;-)

    R Offline
    R Offline
    Reza
    wrote on last edited by
    #9

    @AWI said:

    The sketch you are using is a simple switch with the ir hex value hardcoded. You can rework it to a V_DIMMER and have it sent a few hardcoded values. The part below shows that the switch (V_LIGHT) sends the "Volume up" (0x1EE17887) code when switched on and the "Volume down" (0x1EE1F807) code when set to off.

    i tried to programming several time again and again :( but i can't . I got tired :(
    please help :( if you have a ready sketch for domoticz , please give me until i read this and I learn it
    thank you :(

    AWIA 1 Reply Last reply
    0
    • R Reza

      @AWI said:

      The sketch you are using is a simple switch with the ir hex value hardcoded. You can rework it to a V_DIMMER and have it sent a few hardcoded values. The part below shows that the switch (V_LIGHT) sends the "Volume up" (0x1EE17887) code when switched on and the "Volume down" (0x1EE1F807) code when set to off.

      i tried to programming several time again and again :( but i can't . I got tired :(
      please help :( if you have a ready sketch for domoticz , please give me until i read this and I learn it
      thank you :(

      AWIA Offline
      AWIA Offline
      AWI
      Hero Member
      wrote on last edited by
      #10

      @Reza The sketch you are using is suited for Domoticz but only controls one switch. Were you able to get that working?

      R 1 Reply Last reply
      0
      • AWIA AWI

        @Reza The sketch you are using is suited for Domoticz but only controls one switch. Were you able to get that working?

        R Offline
        R Offline
        Reza
        wrote on last edited by Reza
        #11

        @AWI said:

        The sketch you are using is suited for Domoticz but only controls one switch. Were you able to get that working?

        i want use this for control my ir device (TV or Air conditioning...)
        for TV for example switch(off , on , ch+ ,ch- , vol- , vol + . . . )
        i change sketch again and again...but dont work for me :( I got tired

        AWIA 1 Reply Last reply
        0
        • R Reza

          @AWI said:

          The sketch you are using is suited for Domoticz but only controls one switch. Were you able to get that working?

          i want use this for control my ir device (TV or Air conditioning...)
          for TV for example switch(off , on , ch+ ,ch- , vol- , vol + . . . )
          i change sketch again and again...but dont work for me :( I got tired

          AWIA Offline
          AWIA Offline
          AWI
          Hero Member
          wrote on last edited by
          #12

          @Reza I sense that you expecting "an easy solution" for a kind of universal remote control. As there is no one standard Ir control protocol a lot of effort has been put in creating (Arduino) libraries like irlib/ irlib2. I would suggest to get a working knowledge by using the examples of those libraries.
          Then the next step is to MySensors'ize it and connect to a controller like Domoticz.
          I have limited experience with Ir control protocols (no need ;)) but could help you with the last part...

          R 1 Reply Last reply
          1
          • AWIA AWI

            @Reza I sense that you expecting "an easy solution" for a kind of universal remote control. As there is no one standard Ir control protocol a lot of effort has been put in creating (Arduino) libraries like irlib/ irlib2. I would suggest to get a working knowledge by using the examples of those libraries.
            Then the next step is to MySensors'ize it and connect to a controller like Domoticz.
            I have limited experience with Ir control protocols (no need ;)) but could help you with the last part...

            R Offline
            R Offline
            Reza
            wrote on last edited by
            #13

            @AWI

            i need this for my home now :( quickly :(

            i think every things is related to this part:

            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 incomingRelayStatus = message.getInt();
                 if (incomingRelayStatus == 1) {
                  irsend.send(NEC, 0x1EE17887, 32); // Vol up yamaha ysp-900
                 } else {
                  irsend.send(NEC, 0x1EE1F807, 32); // Vol down yamaha ysp-900
                 }
                 // Start receiving ir again...
                irrecv.enableIRIn(); 
              }
            }
            

            i test this with a V_DIMMER.and use your script (http://192.168.2.110:8080/json.htm?type=command&param=switchlight&idx=971&switchcmd=Set Level&level=0
            ) for level action in domoticz.but dont work...
            where problem in this code ? :(

              if (message.type==V_DIMMER) {
                 int incomingdimmerStatus = message.getInt();
                 if (incomingdimmerStatus == 10) {
                  irsend.send(NEC, 0x1EE23882, 32); 
                 } 
            else if(incomingdimmerStatus == 20) {
                  irsend.send(NEC, 0x1FE1F807, 32); 
                 }
            else if(incomingdimmerStatus == 30) {
                  irsend.send(NEC, 0x1EE1F645, 32); 
                 }
            else if(incomingdimmerStatus == 40) {
                  irsend.send(NEC, 0x1EE1F956, 32); 
                 }
            else if(incomingdimmerStatus == 50) {
                  irsend.send(NEC, 0x1EF1F804, 32); 
                 }
                irrecv.enableIRIn(); 
              }
            }
            
            AWIA 1 Reply Last reply
            0
            • R Reza

              @AWI

              i need this for my home now :( quickly :(

              i think every things is related to this part:

              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 incomingRelayStatus = message.getInt();
                   if (incomingRelayStatus == 1) {
                    irsend.send(NEC, 0x1EE17887, 32); // Vol up yamaha ysp-900
                   } else {
                    irsend.send(NEC, 0x1EE1F807, 32); // Vol down yamaha ysp-900
                   }
                   // Start receiving ir again...
                  irrecv.enableIRIn(); 
                }
              }
              

              i test this with a V_DIMMER.and use your script (http://192.168.2.110:8080/json.htm?type=command&param=switchlight&idx=971&switchcmd=Set Level&level=0
              ) for level action in domoticz.but dont work...
              where problem in this code ? :(

                if (message.type==V_DIMMER) {
                   int incomingdimmerStatus = message.getInt();
                   if (incomingdimmerStatus == 10) {
                    irsend.send(NEC, 0x1EE23882, 32); 
                   } 
              else if(incomingdimmerStatus == 20) {
                    irsend.send(NEC, 0x1FE1F807, 32); 
                   }
              else if(incomingdimmerStatus == 30) {
                    irsend.send(NEC, 0x1EE1F645, 32); 
                   }
              else if(incomingdimmerStatus == 40) {
                    irsend.send(NEC, 0x1EE1F956, 32); 
                   }
              else if(incomingdimmerStatus == 50) {
                    irsend.send(NEC, 0x1EF1F804, 32); 
                   }
                  irrecv.enableIRIn(); 
                }
              }
              
              AWIA Offline
              AWIA Offline
              AWI
              Hero Member
              wrote on last edited by
              #14

              @Reza I guess you better put a few print statements in the code so you can see what is happening on the serial port.

              Did you change the IP address and "idx" values in the script string to match your own setup?

              The "V_DIMMER" values you receive are most likely not exact mulitples of 10 (10.. 20.. 30.. 400) but somewhere in between. You should use a statement like in my example:

              incomingdimmerStatus = map(message.getInt(), 0, 100, 0, 15)  ; // mapper dimmer value to state 0..9  
              

              :smile: you better call 911 if things are really getting out of hand in your home...:scream:

              R 2 Replies Last reply
              2
              • AWIA AWI

                @Reza I guess you better put a few print statements in the code so you can see what is happening on the serial port.

                Did you change the IP address and "idx" values in the script string to match your own setup?

                The "V_DIMMER" values you receive are most likely not exact mulitples of 10 (10.. 20.. 30.. 400) but somewhere in between. You should use a statement like in my example:

                incomingdimmerStatus = map(message.getInt(), 0, 100, 0, 15)  ; // mapper dimmer value to state 0..9  
                

                :smile: you better call 911 if things are really getting out of hand in your home...:scream:

                R Offline
                R Offline
                Reza
                wrote on last edited by
                #15
                This post is deleted!
                1 Reply Last reply
                0
                • AWIA AWI

                  @Reza I guess you better put a few print statements in the code so you can see what is happening on the serial port.

                  Did you change the IP address and "idx" values in the script string to match your own setup?

                  The "V_DIMMER" values you receive are most likely not exact mulitples of 10 (10.. 20.. 30.. 400) but somewhere in between. You should use a statement like in my example:

                  incomingdimmerStatus = map(message.getInt(), 0, 100, 0, 15)  ; // mapper dimmer value to state 0..9  
                  

                  :smile: you better call 911 if things are really getting out of hand in your home...:scream:

                  R Offline
                  R Offline
                  Reza
                  wrote on last edited by
                  #16

                  @AWI
                  i can not :(
                  please help

                  // Enable debug prints
                  #define MY_DEBUG
                  
                  // Enable and select radio type attached
                  #define MY_RADIO_NRF24
                  //#define MY_RADIO_RFM69
                  
                  #define MY_RF24_CHANNEL 0
                  
                  
                  #define MY_REPEATER_FEATURE
                  
                  #include <SPI.h>
                  #include <MySensors.h>
                  #include <IRLib.h>
                  
                  int RECV_PIN = 8;
                  
                  #define CHILD_1  3  // childId
                  
                  IRsend irsend;
                  IRrecv irrecv(RECV_PIN);
                  IRdecode decoder;
                  //decode_results results;
                  unsigned int Buffer[RAWBUF];
                  MyMessage msg(CHILD_1, V_VAR1);
                  
                  void setup()
                  {
                    irrecv.enableIRIn(); // Start the ir receiver
                    decoder.UseExtnBuf(Buffer);
                  
                  }
                  
                  void presentation()  {
                    // Send the sketch version information to the gateway and Controller
                    sendSketchInfo("IR Sensor", "1.0");
                  
                    // Register a sensors to  Use binary light for test purposes.
                    present(CHILD_1, S_LIGHT);
                  }
                  
                  void loop()
                  {
                    if (irrecv.GetResults(&decoder)) {
                      irrecv.resume();
                      decoder.decode();
                      decoder.DumpResults();
                  
                      char buffer[10];
                      sprintf(buffer, "%08lx", decoder.value);
                      // Send ir result to gw
                      send(msg.set(buffer));
                    }
                  }
                  
                  
                  
                  void receive(const MyMessage &message) {
                    if (message.type == V_DIMMER) {
                  ???
                  

                  I don't know what to write here :(

                  i tried for the 3 day on this sketch but i could not .
                  please help :( i just control 4 ir code with a "selector" in domoticz

                  i just want control this ir code:
                  e0e040bf
                  e0e0f00f
                  e0e0d02f
                  e0e0e01f
                  please help :(

                  what is write after this line ?
                  void receive(const MyMessage &message) {
                  if (message.type == V_DIMMER) {

                  so what is change in this code (in level action in domoticz)
                  http://192.168.2.100:8080/json.htm?type=command&param=switchlight&idx=14&switchcmd=Set Level&level=0

                  thank you my friend :(

                  1 Reply Last reply
                  0
                  • hekH Offline
                    hekH Offline
                    hek
                    Admin
                    wrote on last edited by hek
                    #17

                    @Reza, AWI has already given you the hints needed.

                    Please make some research on your own before asking the most basic programming questions here.

                    You cannot bypass acquiring some basic programming! Like loops, if-statements, switches, function calls. We also urge you to get a basic knowledge of build in Arduino apis.

                    The MySensors forum is intended for supporting the MySensors library and related project questions and you are creating irritation among the most patient community members when not acknowledging their requests of increasing your programming skills.

                    I know it it much simpler (for you) to just ask here for a solution to every problem you might encounter... but please don't. Do you homework first. If you don't understand what a function call means google it and read what the api says. Test it in a simple (none mysensors) sketch. Learn!

                    And please stop using :exclamation: marks all over the posts. It's annoying.

                    Sorry for being harsh. But you got to step up here.

                    R 1 Reply Last reply
                    4
                    • hekH hek

                      @Reza, AWI has already given you the hints needed.

                      Please make some research on your own before asking the most basic programming questions here.

                      You cannot bypass acquiring some basic programming! Like loops, if-statements, switches, function calls. We also urge you to get a basic knowledge of build in Arduino apis.

                      The MySensors forum is intended for supporting the MySensors library and related project questions and you are creating irritation among the most patient community members when not acknowledging their requests of increasing your programming skills.

                      I know it it much simpler (for you) to just ask here for a solution to every problem you might encounter... but please don't. Do you homework first. If you don't understand what a function call means google it and read what the api says. Test it in a simple (none mysensors) sketch. Learn!

                      And please stop using :exclamation: marks all over the posts. It's annoying.

                      Sorry for being harsh. But you got to step up here.

                      R Offline
                      R Offline
                      Reza
                      wrote on last edited by
                      #18

                      @hek
                      ok thank you , sorry :(

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      10

                      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