• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


[Partially Supported] TFA / Conrad Weather
No, you can leave pilight as is. Just make sure your own code sends a CRC of 0 and bytes 34 to 37 as 0 as well.
 
Reply
(03-25-2020, 10:51 PM)curlymo Wrote: No, you can leave pilight as is. Just make sure your own code sends a CRC of 0 and bytes 34 to 37 as 0 as well.

Well it doesn't work:

sent not working:0000011000000000100001011010010011000000003 (zeroing as you said, Battery and CRC)

sent working: 0000011000000000100001011010010011000000103 with correct CRC
 
Reply
I was wrong. Making them zero's doesn't bypass the CRC. I will have a look tonight at reversing the CRC but can't promise anything.



It was easier than i expected:
PHP Code:
#include <stdio.h>
#include "binary.h"

int main(void) {
    
int binary[44], icrc 0;

    
/*
     * Randomly fill binary with numbers
     */
    
for(i=0;i<42;i++) {
        if(
== 0) {
            
binary[i] = 1;
        } else {
            
binary[i] = 0;
        }
    }

    
/*
     * Fill battery status
     */
    
decToBinRev(3, (int *)&binary[34]);    // 3 = battery empty, 0 = battery full

    /*
     * Calculate crc
     */
    
for(i=0;i<34;i++) {
        if(
binary[i] != (crc 1)) {
            
crc = (crc >> 1) ^ 12;
        } else {    
            
crc = (crc >> 1);
        }
    }

    
crc ^= binToDec(binary3437);

    
/*
     * Create crc bits in stream
     */
    
decToBinRev(crc, (int *)&binary[38]);

    
/*
     * Test crc check
     */
    
if (crc != binToDec(binary3841)) {
        
printf("error\n");
    } else {
        
printf("succes\n");
    }
    return 
0;

 
Reply
(03-26-2020, 05:07 PM)curlymo Wrote: I was wrong. Making them zero's doesn't bypass the CRC. I will have a look tonight at reversing the CRC but can't promise anything.



It was easier than i expected:
PHP Code:
#include <stdio.h>
#include "binary.h"

int main(void) {
    
int binary[44], icrc 0;

    
/*
     * Randomly fill binary with numbers
     */
    
for(i=0;i<42;i++) {
        if(
== 0) {
            
binary[i] = 1;
        } else {
            
binary[i] = 0;
        }
    }

    
/*
     * Fill battery status
     */
    
decToBinRev(3, (int *)&binary[34]);    // 3 = battery empty, 0 = battery full

    /*
     * Calculate crc
     */
    
for(i=0;i<34;i++) {
        if(
binary[i] != (crc 1)) {
            
crc = (crc >> 1) ^ 12;
        } else {    
            
crc = (crc >> 1);
        }
    }

    
crc ^= binToDec(binary3437);

    
/*
     * Create crc bits in stream
     */
    
decToBinRev(crc, (int *)&binary[38]);

    
/*
     * Test crc check
     */
    
if (crc != binToDec(binary3841)) {
        
printf("error\n");
    } else {
        
printf("succes\n");
    }
    return 
0;


Thanks It gave me headaches and I didn't see it. - Just reversing the CRC-Bit value
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Fully Supported] KlikAanKlikUit Motion Sensor koen01 37 15,274 03-26-2020, 02:46 PM
Last Post: Gisto
  inFactory Weather Sensors porst17 1 370 12-26-2019, 06:43 PM
Last Post: porst17
Lightbulb [Fully Supported] Kaku Door sensor (AMST-606) geerttttt 53 28,415 10-19-2019, 06:26 PM
Last Post: curlymo
  Bresser 3Ch weather sensors Harald654 13 5,991 02-15-2019, 01:06 PM
Last Post: saak2820
  [Fully Supported] DHT22 IcedEarth 86 37,357 11-18-2018, 09:33 AM
Last Post: curlymo
  Weather Station Globaltronics GT-WT-01 Prutsky 13 8,541 04-09-2018, 07:34 PM
Last Post: NevelS
  [Fully Supported] Arctech Old Martin 111 42,593 03-27-2018, 04:43 PM
Last Post: genfersee
  [Fully Supported] Clarus Switches Marcin 69 29,886 01-30-2018, 07:10 PM
Last Post: Niek
  [Fully Supported] Remote Control Socket (RC101-U/RC201) Sean 18 12,864 01-04-2018, 06:18 AM
Last Post: ettman8
  [Fully Supported] LM75 and LM76 temperature sensor horst_dieter 64 28,875 11-19-2017, 08:54 PM
Last Post: edepi

Forum Jump:


Browsing: 1 Guest(s)