pimatic / pimatic-homeduino

Pimatic plugin for using 433mhz devices and sensors with a connected Arduino with homeduino sketch
https://pimatic.org/
GNU General Public License v2.0
37 stars 29 forks source link

Protcol for Aldi Wetterstation #14

Closed mhilcher closed 9 years ago

mhilcher commented 9 years ago

Hi, I played around to find a protocol for the Sempre Weatherstation, which Aldi Süd in Germany sold a few weeks ago. I modified the weather1 protocol and built a new one which works. It's not perfect yet, there are still some bits I cannot assign, but at least id, temperature and huniditiy are working. I still have to find out, where the temperature exactly starts. When there will be negative degrees in the winter, I will find out ;-) And I will find out, which bit is the battery bit when the battery will be low.

Here's the source code for "weather9.js"

module.exports = function(helper) {
  var protocolInfo, pulsesToBinaryMapping;
  pulsesToBinaryMapping = {
    '01': '0',
    '02': '1',
    '03': ''
  };
  return protocolInfo = {
    name: 'weather9',
    type: 'weather',
    values: {
      temperature: {
        type: "number"
      },
      humidity: {
        type: "number"
      },
      channel: {
        type: "number"
      },
      id: {
        type: "number"
      },
      battery: {
        type: "number"
      }
    },
    brands: ["Sempre (Aldi) GT-WT-02"],
    pulseLengths: [552, 2089, 4137, 9032],
    pulseCount: 80,
    /*
    Bits:       |0 0 0 0 0 0 0 0 |0 0 |1 1 1 1 1 1 1 1 1 1 2 2 2 2 |2 2 2 2 2 2 3 |3 3 3 3 3 3 |  |3 |  |
                |0 1 2 3 4 5 6 7 |8 9 |0 1 2 3 4 5 6 7 8 9 0 1 2 3 |4 5 6 7 8 9 0 |1 2 3 4 5 6 |  |7 |  |
    Pulse like: |0102010201020202|0101|0101010101010102010202010201|02010102020101|020102020101|03|01|03|
                |01010111        |00  |000001011010                |1001100       |101100      |  |0 |  |
                |Id              |Ch ?|Temperature                 |Humidity      |?           |  |? |  |
                |87              |    |90 (9.0)                    |76            |            |  |  |  |
    */
    decodePulses: function(pulses) {
      var battery, binary, result;
      binary = helper.map(pulses, pulsesToBinaryMapping);
      battery = helper.binaryToNumber(binary, 37, 37);
      if (battery === 1) {
        battery = "Good";
      } else {
        battery = "Bad";
      }
      return result = {
        id: helper.binaryToNumber(binary, 0, 7),
        channel: helper.binaryToNumber(binary, 8, 9) + 1,
        temperature: helper.binaryToSignedNumber(binary, 10, 23) / 10,
        humidity: helper.binaryToNumber(binary, 24, 30),
        battery: battery
      };
    }
  };
};
sweetpi commented 9 years ago

Very nice, thanks for sharing. You can also make a pull request next time. Then you are clearly labeled as author in the git history.

I published pimatic-homeduino 0.8.30 with updated rfcontroljs.