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. IRSensor

IRSensor

Scheduled Pinned Locked Moved My Project
9 Posts 5 Posters 2.6k Views 4 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.
  • foggyF Offline
    foggyF Offline
    foggy
    wrote on last edited by
    #1

    Hi All,

    I may have misunderstood the use case here.
    Following the build http://www.mysensors.org/build/ir

    I have connected only an IR Receive Sensor to Power 5V Grnd & Pin 8.
    IR Transmitter is not connected

    What I am trying to achieve is to press a button on a remote and then have domoticz act upon it through a script.

    The Sensor serial monitor appears to be telling me that it is communicating with the Gateway, at least I don't see "Fail" anywhere. I can also see reference to IRSensor in the Domoticz log. So far so good.

    A couple of questions
    However I don't appear to see any device in the Domoticz list that I can add. Have I missed a step?

    I can see that some of the code has been commented out. Do I need to uncomment some of this (or all of it) in order for it to decode the IR button. I notice that some of it has // and some of it has /.../ Not really sure if I am supposed to uncomment all of it or just some.

    Any help is greatly appreciated.

    Best Wishes.

    James.

    1 Reply Last reply
    0
    • TheoLT Offline
      TheoLT Offline
      TheoL
      Contest Winner
      wrote on last edited by
      #2

      Are you sure the IR sensor isn't broken? AdAfruit has a good tutorial on this link text

      1 Reply Last reply
      0
      • foggyF Offline
        foggyF Offline
        foggy
        wrote on last edited by
        #3

        Thank you. I don't think it is broken. If I press a key on the remote I can see some output in the serial monitor. I just don't see any device in domoticz.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          drock1985
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • Boots33B Offline
            Boots33B Offline
            Boots33
            Hero Member
            wrote on last edited by
            #5

            Is the ir node not showing up in the mysensor gateway under the hardware settings tab?

            1 Reply Last reply
            0
            • foggyF Offline
              foggyF Offline
              foggy
              wrote on last edited by
              #6

              Yes - The gateway is shown under Hardware. I am using it with other nodes Temp sensors.

              I can also see the IR sensor in the Domoticz log

              2016-02-05 07:51:23.671 MySensors: Node: 14, Sketch Name: IR Sensor
              2016-02-05 07:51:23.702 MySensors: Node: 14, Sketch Version: 1.0
              

              I just can't find a device I can add.

              Best wishes.

              James.

              1 Reply Last reply
              0
              • sundberg84S Offline
                sundberg84S Offline
                sundberg84
                Hardware Contributor
                wrote on last edited by sundberg84
                #7

                Devices in Domoticz is not added until a correct first value is sent, its not enough with a presentation - is this the case?

                Controller: Proxmox VM - Home Assistant
                MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                foggyF 1 Reply Last reply
                0
                • sundberg84S sundberg84

                  Devices in Domoticz is not added until a correct first value is sent, its not enough with a presentation - is this the case?

                  foggyF Offline
                  foggyF Offline
                  foggy
                  wrote on last edited by
                  #8

                  @sundberg84
                  Thank you. I thought that might be the case. Hence my second original question

                  I can see that some of the code has been commented out. Do I need to uncomment some of this (or all of it) in order for it to decode the IR button. I notice that some of it has // and some of it has /.../ Not really sure if I am supposed to uncomment all of it or just some.

                  // Dumps out the decode_results structure.
                  // Call this after IRrecv::decode()
                  // void * to work around compiler issue
                  //void dump(void *v) {
                  //  decode_results *results = (decode_results *)v
                  /*void dump(decode_results *results) {
                    int count = results->rawlen;
                    if (results->decode_type == UNKNOWN) {
                      Serial.print("Unknown encoding: ");
                    } 
                    else if (results->decode_type == NEC) {
                      Serial.print("Decoded NEC: ");
                    } 
                    else if (results->decode_type == SONY) {
                      Serial.print("Decoded SONY: ");
                    } 
                    else if (results->decode_type == RC5) {
                      Serial.print("Decoded RC5: ");
                    } 
                    else if (results->decode_type == RC6) {
                      Serial.print("Decoded RC6: ");
                    }
                    else if (results->decode_type == PANASONIC) {	
                      Serial.print("Decoded PANASONIC - Address: ");
                      Serial.print(results->panasonicAddress,HEX);
                      Serial.print(" Value: ");
                    }
                    else if (results->decode_type == JVC) {
                       Serial.print("Decoded JVC: ");
                    }
                    Serial.print(results->value, HEX);
                    Serial.print(" (");
                    Serial.print(results->bits, DEC);
                    Serial.println(" bits)");
                    Serial.print("Raw (");
                    Serial.print(count, DEC);
                    Serial.print("): ");
                  
                    for (int i = 0; i < count; i++) {
                      if ((i % 2) == 1) {
                        Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
                      } 
                      else {
                        Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
                      }
                      Serial.print(" ");
                    }
                    Serial.println("");
                  }
                  */
                  

                  Can you advise what I should uncomment?
                  I presume once I have got the correct code from the serial monitor and running above. I can then enter it here

                  void incomingMessage(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(); 
                    }
                  }
                  

                  This will then allow Domoticz to create the device switch.

                  Thank you for any help you can give.

                  Best wishes.

                  James

                  1 Reply Last reply
                  0
                  • foggyF Offline
                    foggyF Offline
                    foggy
                    wrote on last edited by
                    #9

                    I thought I would close this. Just as well that my Google skills are better than my programming skills.

                    This sketch helped me out and resolved my issues.

                    https://www.domoticz.com/forum/viewtopic.php?f=42&t=7648&start=20#p53663
                    by gizmocuz. Thank you.

                    Best wishes.

                    James.

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


                    13

                    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