Port of MySensors Library 1.4 to Raspberry



  • Hi all, I port 1.4 library to Raspberry, it's not complete but is functional, check raspberry repo in github



  • Perfect!

    Could you post the Link to the Project?



  • not functional

    MySensor.cpp:232: undefined reference to `RF24::write(void const*, unsigned char, bool)'





  • @b0rmann HI, there are no problem with this line, can you post build output.



  • @aliasdoc yes, i can :)

    ~/Raspberry $ make
    g++ -c -o MyGateway.o MyGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Ilibrf24-bcm/
    g++ -c -o MySensor.o MySensor.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Ilibrf24-bcm/
    g++ -c -o MyMessage.o MyMessage.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Ilibrf24-bcm/
    g++ -c -o PiGateway.o PiGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Ilibrf24-bcm/
    PiGateway.cpp: In function ‘void setup()’:
    PiGateway.cpp:26:88: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    g++ -o PiGateway MyGateway.o MySensor.o MyMessage.o PiGateway.o -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Ilibrf24-bcm/ -lrf24-bcm
    MySensor.o: In function MySensor::setupRadio(rf24_pa_dbm_e, unsigned char, rf24_datarate_e)': /home/pi/Raspberry/MySensor.cpp:121: undefined reference toRF24::setPALevel(unsigned char)'
    MySensor.o: In function MySensor::sendWrite(unsigned char, MyMessage&, bool)': /home/pi/Raspberry/MySensor.cpp:231: undefined reference toRF24::write(void const*, unsigned char, bool)'
    /home/pi/Raspberry/MySensor.cpp:231: undefined reference to RF24::write(void const*, unsigned char, bool)' /home/pi/Raspberry/MySensor.cpp:231: undefined reference toRF24::write(void const*, unsigned char, bool)'
    /home/pi/Raspberry/MySensor.cpp:231: undefined reference to RF24::write(void const*, unsigned char, bool)' /home/pi/Raspberry/MySensor.cpp:231: undefined reference toRF24::write(void const*, unsigned char, bool)'
    MySensor.o:/home/pi/Raspberry/MySensor.cpp:231: more undefined references to `RF24::write(void const*, unsigned char, bool)' follow
    collect2: ld returned 1 exit status
    Makefile:18: recipe for target 'PiGateway' failed
    make: *** [PiGateway] Error 1



  • Ok, post an issue in github repo. Try to compile using this command "make clean all"



  • Hi

    Im working on a MQTT Port for the Pi, based on your work. During debuging, a discovered a strange behavior. If i connect my Sensor to a Arduino-Gateway, everything works well. As soon as i connect the same Sensor to a Pi-Gateway, the Gateway receives the Messages, but on the Sensor-Side, the Logs looks quiet Special:

    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=ok:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=ok:55.4
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=ok:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=ok:1
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.4
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:0
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.4
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 0-0-20 s=255,c=3,t=8,pt=1,l=1:0
    new parent=0, d=1
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=ok:0
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=ok:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=ok:55.4
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:1
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.4
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:0
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=ok:55.3
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=ok:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=ok:0
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.3
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:1
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.3
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 0-0-20 s=255,c=3,t=8,pt=1,l=1:0
    new parent=0, d=1
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=ok:0
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=ok:97
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=ok:1
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:0
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:1
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:0
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=ok:0
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=ok:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=ok:55.3
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=ok:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:1
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.3
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:0
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.3
    send: 20-20-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=ok:96
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=ok:0
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=ok:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.3
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:1
    send: 20-20-0-0 s=3,c=1,t=0,pt=7,l=5,st=fail:21.1
    send: 20-20-0-0 s=2,c=1,t=1,pt=7,l=5,st=fail:55.3
    send: 20-20-0-0 s=4,c=1,t=23,pt=7,l=5,st=fail:97
    send: 20-20-0-0 s=1,c=1,t=16,pt=0,l=1,st=fail:0
    send: 20-20-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 20-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 0-0-20 s=255,c=3,t=8,pt=1,l=1:0
    new parent=0, d=1

    As you can see, there is kind of a Pattern ocouring every 14 Messages starting with 3-4 OK, followed by 7 FAIL and then the Discovery. Any Ideas what the cause ot this behavor could be?

    Greetings

    busa



  • Hi guys,

    Im trying to get my raspberry PI to act like a gateway/controller, where the nodes request an id from the controller. But Im stuck sending back the response to the sensor set message.

    I have updated the PiGateway.cpp to detect the ID request message, and respond using the parseAndSend function. The sensor node appears to accept the response, and then sends a set message indicating the sensor value. However Im not sure how to respond to this.

    What do I need send back so that the sensor treats it as success rather than failure?

    Thanks

    Kihon



  • Hello Guys ,

    I am looking to run the rasp pi as gateway+controller with the nrf24 . Please where should i start from does it have any explanation like we have for the arduino s running mysensor ? .


Log in to reply
 

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