setup ir sensor with domoticz !



  • hi
    i dont know , how setup ir sensor with domoticz !
    after add sensor i have a switch ! i add a virtual device ( selector ) . . .
    0_1474468141855_123.jpg
    in edit virtual device , what do am I ? for add some IR code to virtual device ?
    0_1474468260218_1234.jpg
    i think most put a code in level action !! but i dont know . . .


  • Admin

    Have you tried looking at the forum over at domoticz.com?



  • @tbowmo said:

    Have you tried looking at the forum over at domoticz.com?

    yes but there are no body to help !!!
    http://www.domoticz.com/forum/viewtopic.php?f=4&t=13447


  • Hero Member

    @Reza Hi, I am working on a summary for using the switch /selector in Domoticz (will finish it this weekend). Basically you have to put Domoticz JSON calls in the "Level Action" fields. Just let me know what you want to accomplish (i.e. sketch) and I will do my best...



  • @AWI said:

    Hi, I am working on a summary for using the switch /selector in Domoticz (will finish it this weekend). Basically you have to put Domoticz JSON calls in the "Level Action" fields. Just let me know what you want to accomplish (i.e. sketch) and I will do my best...

    so this is very excellent :) then can you share with me ? i need this Strongly.


  • Hero Member

    @Reza I have uploaded a Domoticz selector switch tutorial to demonstrate how to use the device. You need to rework it to serve your IR purpose. Have fun!



  • @AWI
    hi
    so in Selector actions i must enter :
    http://192.168.2.110:8080/json.htm?type=command&param=switchlight&idx=971&switchcmd=Set Level&level=0

    change ip and change node-id in this link !?
    but this is for dimmer ! i want send a ir code (for example 0x1EE17887)

    i use sketch in mysensors: https://www.mysensors.org/build/ir


  • Hero Member

    @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 ;-)



  • @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 :(


  • Hero Member

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



  • @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


  • Hero Member

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



  • @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(); 
      }
    }
    

  • Hero Member

    @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:



  • This post is deleted!


  • @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 :(


  • Admin

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



  • @hek
    ok thank you , sorry :(


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.