Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. PiSerialGateway and Domoticz

PiSerialGateway and Domoticz

Scheduled Pinned Locked Moved Troubleshooting
15 Posts 3 Posters 2.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • raptorjrR Offline
    raptorjrR Offline
    raptorjr
    wrote on last edited by
    #1

    So I'm trying to setup PiSerialGateway with a nrf24l01+. I'm getting some output but I don't understand it. If the sensors only scream out into the air or if they are communicating?

    I know that my sketch is working, because if I attach it to my Pi3 with USB cable as a ordinary SerialGateway my sensors appear in Domoticz.

    This it the output I have from my sketch with debug turned on. Don't know where it starts or ends so I just copy a few lines.

    TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSF:MSG:FPAR RES,ID=0,D=0
    TSF:MSG:FPAR OK,ID=0,D=1
    TSM:FPAR:OK
    TSM:ID
    TSM:ID:OK,ID=1
    TSM:UPL
    TSF:PING:SEND,TO=0
    TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    TSF:CHKUPL:FAIL
    !TSM:UPL:FAIL
    TSM:FPAR
    TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSF:MSG:FPAR RES,ID=0,D=0
    TSF:MSG:FPAR OK,ID=0,D=1
    TSM:FPAR:OK
    TSM:ID
    TSM:ID:OK,ID=1
    TSM:UPL
    TSF:PING:SEND,TO=0
    TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    TSF:CHKUPL:FAIL
    !TSM:UPL:FAIL
    TSM:FPAR
    TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSF:MSG:FPAR RES,ID=0,D=0
    TSF:MSG:FPAR OK,ID=0,D=1
    TSM:FPAR:OK
    TSM:ID
    TSM:ID:OK,ID=1
    TSM:UPL
    TSF:PING:SEND,TO=0
    TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    TSF:CHKUPL:FAIL
    !TSM:UPL:FAIL
    TSM:FPAR
    TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSF:MSG:FPAR RES,ID=0,D=0
    TSF:MSG:FPAR OK,ID=0,D=1
    TSM:FPAR:OK
    TSM:ID
    TSM:ID:OK,ID=1
    TSM:UPL
    TSF:PING:SEND,TO=0
    

    And this is what the PiSerialGateway "says":

    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 1-1-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    

    I only had 470µF capacitor, don't know if it is too big and that could be a problem?

    Also, I don't know how to get a decent log file from PiSerialGateway? The only way I can get some output is to start it manually. I've been reading as much as I can find, but don't know how I can get this to work.

    1 Reply Last reply
    0
    • Fat FlyF Offline
      Fat FlyF Offline
      Fat Fly
      wrote on last edited by
      #2

      Try with 10µF capacitor. 470 is too big .

      1 Reply Last reply
      0
      • raptorjrR Offline
        raptorjrR Offline
        raptorjr
        wrote on last edited by raptorjr
        #3

        Thank you. Bought some 10µF.

        But I don't see any change in the output from the sensor or the gateway. Have been waiting 5-10 minutes, but nothing appears in Domoticz. Is there anything I can do to try to find the problem? I seem to get the output described on other webpages for working sensor/gateway. But they don't seem to connect.

        And how do I get the log function to work? The few times when a log is created I only see some startup message. Nothing about the communication going on. I have to start PiSerialGateway manually to see any communication output. Or isn't that possible to see in the log file?

        Here is the sensorsketch, if I have forgotten something. Works fine with plain USB connection to my Pi.

        // Enable serial gateway
        //#define MY_GATEWAY_SERIAL 
        
        // Enable debug prints to serial monitor
        #define MY_DEBUG 
        
        // Enable and select radio type attached
        #define MY_RADIO_NRF24
        
        #include <SPI.h>
        #include <MySensors.h>  
        #include <OneWire.h>
        #include <DallasTemperature.h>
        
        #define TEMP_ID 1
        #define RELAY_ID 2
        
        //Temperatur sensor
        #define ONE_WIRE_BUS 4
        #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No
        float lastTemperature = 0;
        MyMessage tempMsg(TEMP_ID, V_TEMP); // Initialize temperature message
        OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
        DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature. 
        unsigned long SLEEP_TIME = 5000; // Sleep time between reads (in milliseconds)
        
        //Relay to water valve
        #define RELAY_PIN  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
        #define RELAY_ON 1  // GPIO value to write to turn on attached relay
        #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
        
        void setup(void)
        {
        	// start serial port
        	Serial.begin(115200);
        
        	pinMode(RELAY_PIN, OUTPUT);
        	digitalWrite(RELAY_PIN, RELAY_OFF);
        }
        
        void presentation() 
        {
        	// Send the sketch version information to the gateway and Controller
        	sendSketchInfo("FishTank", "1.0");
        
        	present(TEMP_ID, S_TEMP, "Water temperature");
        
        	present(RELAY_ID, S_BINARY, "Water valve");
        }
        
        void loop(void)
        { 
        
        	DeviceAddress tempDeviceAddress; // We'll use this variable to store a found device address    
        	// For testing purposes, reset the bus every loop so we can see if any devices appear or fall off
        	sensors.begin();
        	sensors.requestTemperatures(); // Send the command to get temperatures
        	
        	// Search the wire for address
           if(sensors.getAddress(tempDeviceAddress, 0))
           {
        		float tempC = sensors.getTempC(tempDeviceAddress);
        		//Serial.print("Temperature=");
        		//Serial.println(tempC); 
        #if COMPARE_TEMP == 1
        		// Only send data if temperature has changed and no error
        		if (lastTemperature != tempC && tempC != -127.00 && tempC != 85.00)
        		{
        #else
        		if (tempC != -127.00 && tempC != 85.00)
        		{
        #endif
        			// Send in the new temperature
        			send(tempMsg.set(tempC, 1));
        			// Save new temperatures for next compare
        			lastTemperature = tempC;
        		}
           } 
        
        	delay(SLEEP_TIME);
        }
        
        void receive(const MyMessage &message) 
        {
        	// We only expect one type of message from controller. But we better check anyway.
        	if (message.type == V_STATUS) 
        	{
        		// Change relay state
        		digitalWrite(RELAY_PIN, message.getBool() ? RELAY_ON : RELAY_OFF);
        		// Write some debug info
        		Serial.print("Incoming change for sensor:");
        		Serial.print(message.sensor);
        		Serial.print(", New status: ");
        		Serial.println(message.getBool());
        	}
        }
        
        1 Reply Last reply
        0
        • Fat FlyF Offline
          Fat FlyF Offline
          Fat Fly
          wrote on last edited by
          #4

          Connect gateway to comp usb and check what happening with arduino ide serial monitor.

          raptorjrR 1 Reply Last reply
          0
          • Fat FlyF Fat Fly

            Connect gateway to comp usb and check what happening with arduino ide serial monitor.

            raptorjrR Offline
            raptorjrR Offline
            raptorjr
            wrote on last edited by
            #5

            @Fat-Fly
            I don't really understand. The gateway is on a Raspberry Pi, and I have a piece of what is happening in my first post. The output from PiSerialGateway. Otherwise you have to explain a little more on how I should connect my RPi to USB and what to look for.

            1 Reply Last reply
            0
            • Fat FlyF Offline
              Fat FlyF Offline
              Fat Fly
              wrote on last edited by
              #6

              Connect arduino with nrf to comp. Not raspberry. And check serial monitor.

              raptorjrR 1 Reply Last reply
              0
              • Fat FlyF Fat Fly

                Connect arduino with nrf to comp. Not raspberry. And check serial monitor.

                raptorjrR Offline
                raptorjrR Offline
                raptorjr
                wrote on last edited by
                #7

                @Fat-Fly

                But the NRF is connected directly to the Raspberry. There is no Arduino on the gateway. And the output from my node (Arduino and NRF) with sensors is also shown in my first post.

                I'm really lost on what you want me to test.

                1 Reply Last reply
                0
                • Fat FlyF Offline
                  Fat FlyF Offline
                  Fat Fly
                  wrote on last edited by
                  #8

                  Okay. With mysensors 2.0 not working nrf directly. Use 1.5 library.

                  raptorjrR 1 Reply Last reply
                  0
                  • Fat FlyF Fat Fly

                    Okay. With mysensors 2.0 not working nrf directly. Use 1.5 library.

                    raptorjrR Offline
                    raptorjrR Offline
                    raptorjr
                    wrote on last edited by
                    #9

                    @Fat-Fly

                    Really? They removed that or is it a bug? Didn't think that 2.0 would be a problem. But could test, but sad to not be able to use the latest version.

                    mfalkviddM 1 Reply Last reply
                    0
                    • raptorjrR raptorjr

                      @Fat-Fly

                      Really? They removed that or is it a bug? Didn't think that 2.0 would be a problem. But could test, but sad to not be able to use the latest version.

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #10

                      @raptorjr this thread discusses an alternative implementation of the Raspberry Pi gateway, compatible with MySensors 2.0.

                      raptorjrR 1 Reply Last reply
                      0
                      • Fat FlyF Offline
                        Fat FlyF Offline
                        Fat Fly
                        wrote on last edited by
                        #11

                        2.0 is compatible connect nrf directly to raspberry? I do not know and not read this. Maybe i sleep this moment when somebody writing from this. :)

                        1 Reply Last reply
                        0
                        • mfalkviddM mfalkvidd

                          @raptorjr this thread discusses an alternative implementation of the Raspberry Pi gateway, compatible with MySensors 2.0.

                          raptorjrR Offline
                          raptorjrR Offline
                          raptorjr
                          wrote on last edited by
                          #12

                          @mfalkvidd

                          Thank you, will check it out. Would be sad to leave 2.0. It seems to be a big step forward in the development.

                          1 Reply Last reply
                          0
                          • Fat FlyF Offline
                            Fat FlyF Offline
                            Fat Fly
                            wrote on last edited by
                            #13

                            :D :) :-)

                            1 Reply Last reply
                            0
                            • raptorjrR Offline
                              raptorjrR Offline
                              raptorjr
                              wrote on last edited by
                              #14

                              It works =)

                              1 Reply Last reply
                              1
                              • Fat FlyF Offline
                                Fat FlyF Offline
                                Fat Fly
                                wrote on last edited by
                                #15

                                Beer from you.

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                23

                                Online

                                11.7k

                                Users

                                11.2k

                                Topics

                                113.1k

                                Posts


                                Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • MySensors
                                • OpenHardware.io
                                • Categories
                                • Recent
                                • Tags
                                • Popular