Avatar for motoi

motoi

Member since Dec 2014 • Last active Dec 2014
  • 1 conversations
  • 1 comments

Most recent activity

  • in Interfacing
    Avatar for motoi

    Hi,
    At first, I want to apologize for my english. (I'm French)

    I have bought a switch of the brand DIO by Chacon.

    I'm trying to get the code send by this switch to be able to repeat it.

    It works with the HomeEasy protocol :

    The data is encoded on the wire (aerial) as a Manchester code.

    A latch of 275us high, 2675us low is sent before the data.
    There is a gap of 10ms between each message.

    0 = holding the line high for 275us then low for 275us.
    1 = holding the line high for 275us then low for 1225us.

    The timings seem to vary quite noticably between devices. HE300 devices have a
    low for about 1300us for a 1 whereas HE303 devices seem to have a low of about
    1100us. If this script does not detect your signals try relaxing the timing
    conditions.

    Each actual bit of data is encoded as two bits on the wire as:
    Data 0 = Wire 01
    Data 1 = Wire 10

    The actual message is 32 bits of data (64 wire bits):
    bits 0-25: the group code - a 26bit number assigned to controllers.
    bit 26: group flag
    bit 27: on/off flag
    bits 28-31: the device code - a 4bit number.

    So, I was trying to adapte the "Remote Control Sockets" tutorial with this instructions :

    var t,n;
    
    // When the signal rises, check if it was after ~5ms of delay - if so (and if we have a code) display it.
    function sigOn(e) {
      var d = e.time-t;
      if (d>0.0025 && n>0) {
        console.log("0b"+n.toString(2));
        n=0;
      }
      t = e.time;
    }
    
    // When the signal falls, measure the length of our pulse. 
    // If it was within range, record a 1 or a 0 depending on the length. 
    // If it wasn't in range, zero it
    function sigOff(e) {
      var d = e.time-t;
      t = e.time;
      if (d>0.0002 && d<0.0012)
        n = (n<<1) | ((d>=0.0007)?1:0);
      else
        n=0;
    }
    
    setWatch(sigOn,A1,{repeat:true,edge:"ris­ing"});
    setWatch(sigOff,A1,{repeat:true,edge:"fa­lling"});
    

    And this is my output :

    0b1
    0b1100
    0b111
    0b101
    0b111
    0b111
    0b1
    0b1
    0b110
    0b1000001
    0b1111
    0b110000
    0b1
    0b11
    ...
    

    I have nothing to exploit here.

    Can you help me?

Actions