A few noob questions



  • Hi,

    I´m absolutely new to MySensors. I have Domoticz connected to my Yeelight-System.
    Now I wanted to expand with Arduinos, PIDs, light sensors..
    First off I played around a bit with my Uno, Raspi and some sensors. My NRF24L01+ on Raspi and Arduino were able to ping and answer, all fine. Luxmeter and PIR gave the output expected.
    Then I read about MySensors, installed on the Raspberry (dev channel, stable did not work).Gateway type ethernet. Log sais all fine.

    1. Question: as I read, there is no way just to see what is connected to the RPI, which sensor sends what.. right? All I have is the option to fully debug to a file. If I have a connection to a sensor, I have to set it up in Domotics to read the values?

    Ok, Raspi runs fine, now I tried to set up my Uno. MySensors-Libary is included, I can compile just fine. Problem: I always get the following on my serial monitor (if debug is enabled):

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    11 TSM:INIT:TSP OK
    13 TSM:FPAR
    15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2022 !TSM:FPAR:NO REPLY
    2024 TSM:FPAR
    2026 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4034 !TSM:FPAR:NO REPLY
    4036 TSM:FPAR
    4038 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6046 !TSM:FPAR:NO REPLY
    6048 TSM:FPAR
    6050 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8058 !TSM:FPAR:FAIL
    8059 TSM:FAIL:CNT=1
    8061 TSM:FAIL:PDT
    18065 TSM:FAIL:RE-INIT
    ...
    

    I have no idea what it wants to tell me. It sends four times, gets no answer, so I get an error and it starts from the beginning.

    1. Question: where can I get a good documentation, which tells me what is normal, what is sended. Would also be awesome if I could see what the Raspi receives. If I open syslog, it tells me just all is fine once in an hour.

    I also downloaded the BT1750 libary, as linked on the tutorial page. Is not the first libary I added manually, so folder should be correct. If I now compile, I get a lot of errors:

    In file included from C:\Users\Inso\AppData\Local\Temp\arduino_modified_sketch_59209\LightSensor.ino:50:0:
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:30:3: error: stray '\302' in program
    
       <title>MySensorsArduinoExamples/BH1750.h at master · mysensors/MySensorsArduinoExamples · GitHub</title>
    
       ^
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:30:3: error: stray '\267' in program
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:30:3: error: stray '\302' in program
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:30:3: error: stray '\267' in program
    
    In file included from C:\Users\Inso\AppData\Local\Temp\arduino_modified_sketch_59209\LightSensor.ino:50:0:
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:151:8: warning: missing terminating ' character
    
       <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/mysensors/MySensorsArduinoExamples/search" class="js-site-search-form" data-scoped-search-url="/mysensors/MySensorsArduinoExamples/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
    
            ^
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:151:3: error: missing terminating ' character
    
       <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/mysensors/MySensorsArduinoExamples/search" class="js-site-search-form" data-scoped-search-url="/mysensors/MySensorsArduinoExamples/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
    
       ^
    
    In file included from C:\Users\Inso\AppData\Local\Temp\arduino_modified_sketch_59209\LightSensor.ino:50:0:
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:313:48: error: exponent has no digits
    
       <!-- blob contrib key: blob_contributors:v21:982ea3630030e14dff7f417b07c6caf3 -->
    
                                                    ^
    
    In file included from C:\Users\Inso\AppData\Local\Temp\arduino_modified_sketch_59209\LightSensor.ino:50:0:
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:532:70: error: stray '#' in program
    
             <td id="LC16" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">ifndef</span> BH1750_h</td>
    
                                                                          ^
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:536:70: error: stray '#' in program
    
             <td id="LC17" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">BH1750_h</span></td>
    
                                                                          ^
    
    C:\Users\Inso\Documents\Arduino\libraries\BH1750/BH1750.h:545:70: error: stray '#' in program
    
             <td id="LC19" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">if</span> (ARDUINO &gt;= 100)</td>
    
    [...]
    
    
    1. Question: Any idea what wents wrong? Folder on Github says it´s all up to date, my Arduino IDE is 1.8.5

    There is also a lot of good code on the net.

    1. Question: If I want to use that code, what is neccessary to add so MySensors can handle the data? I add
    #define MY_RADIO_NRF24
    

    so it sends my data,
    and

    present(CHILD_ID, S_MOTION); 
    

    so it adds my Arduino as a Sensor, gives a unique ID.

    sendSketchInfo 
    

    is the data I send.
    Here it starts - is there a wiki, hopefully with a few examples, where I can see which data has to be send, what is needed, how I can set up my own code..?

    Thanks a lot for reading my wall of text, everything is appriciated 🙂


  • Mod

    @Inso

    Question: as I read, there is no way just to see what is connected to the RPI, which sensor sends what.. right? All I have is the option to fully debug to a file. If I have a connection to a sensor, I have to set it up in Domotics to read the values?

    There is no "connection" to sensors really. Sensors send messages whenever they are programmed to. The gateway forwards those messages to the chosen output (serial, ethernet , mqtt, etc). The format of the output is called "serial protocol" (because it originated from serial but the same protocol is used for ethernet, ...). The serial protocol is described at https://www.mysensors.org/download/serial_api_20

    It sends four times, gets no answer, so I get an error and it starts from the beginning.

    The log parser can be useful to get details on what the log is saying.

    In your case, the node is asking the controller for a sensor node id. The gateway logs this "ask" message and forwards it to the output. But there is no reply from the controller. Have you added the gateway in Domoticz? If so, could you post your settings from the Domoticz hardware tab, the Domoticz log and the configure command you used for the raspi gateway?

    Question: where can I get a good documentation, which tells me what is normal, what is sended

    The log parser and the serial protocol are the main sources. But if you haven't already, read the getting started guide. Reading that will give you the background needed to understand how things fit together.

    Question: Any idea what wents wrong?

    There seems to be a lot of html code in that library. There shouldn't be any html code in a library. Where did you download it from and how did you download it? Maybe you accidentally saved the github html page instead of saving the (raw) library file?

    Question: If I want to use that code, what is neccessary to add so MySensors can handle the data?

    Have you seen the instructions and the example sketch at https://www.mysensors.org/build/light-bh1750 ? They are intended to provide all you need to get the sensor working, but we may have failed.

    I hope this helps. If you have further questions, just ask (but do read the instructions I linked first, they are intended to bring people up to speed as easily and quickly as possible so hopefully they'll save you some time)



  • @mfalkvidd

    Thank you very much for your answer 🙂

    @mfalkvidd said in A few noob questions:

    @Inso

    There is no "connection" to sensors really. Sensors send messages whenever they are programmed to. The gateway forwards those messages to the chosen output (serial, ethernet , mqtt, etc). The format of the output is called "serial protocol" (because it originated from serial but the same protocol is used for ethernet, ...). The serial protocol is described at https://www.mysensors.org/download/serial_api_20

    The log parser can be useful to get details on what the log is saying.

    Very helpful, thank you 🙂

    In your case, the node is asking the controller for a sensor node id. The gateway logs this "ask" message and forwards it to the output. But there is no reply from the controller. Have you added the gateway in Domoticz? If so, could you post your settings from the Domoticz hardware tab, the Domoticz log and the configure command you used for the raspi gateway?

    0_1510058657248_Hardware1.jpg

    0_1510075401511_HW3.jpg

    0_1510075407685_HW4.jpg

     2017-11-07 14:27:53.024 Domoticz V3.8153 (c)2012-2017 GizMoCuz
    2017-11-07 14:27:53.025 Build Hash: 494fff7, Date: 2017-07-30 12:19:41
    2017-11-07 14:27:53.026 Startup Path: /home/pi/domoticz/
    2017-11-07 14:27:54.028 PluginSystem: Started, Python version '3.5.3'.
    2017-11-07 14:27:54.046 Active notification Subsystems: gcm, http (2/12)
    2017-11-07 14:27:54.082 WebServer(HTTP) started on address: :: with port 8080
    2017-11-07 14:27:54.100 WebServer(SSL) started on address: :: with port 443
    2017-11-07 14:27:54.101 Proxymanager started.
    2017-11-07 14:27:54.102 Starting shared server on: :::6144
    2017-11-07 14:27:54.102 TCPServer: shared server started...
    2017-11-07 14:27:54.103 RxQueue: queue worker started...
    2017-11-07 14:27:56.197 EventSystem: reset all events...
    2017-11-07 14:27:56.211 EventSystem: reset all device statuses...
    2017-11-07 14:27:56.365 Python EventSystem: Module not found - Trying to initialize.
    2017-11-07 14:27:56.366 Python EventSystem: Initalizing event module.
    2017-11-07 14:27:56.367 EventSystem: Started
    2017-11-07 14:27:56.529 PluginSystem: Entering work loop.
    2017-11-07 14:27:57.196 MySensors: trying to connect to: 192.168.178.66:5003
    2017-11-07 14:27:58.197 Error: MySensors: Network is unreachable
    2017-11-07 14:27:58.197 Error: TCP: Error: Network is unreachable
    2017-11-07 14:27:58.197 TCP: Reconnecting in 30 seconds...
    2017-11-07 14:28:08.706 Incoming connection from: 192.168.178.37
    2017-11-07 14:28:48.762 TCP: Reconnecting...
    2017-11-07 14:28:48.762 MySensors: connected to: 192.168.178.66:5003
    2017-11-07 14:28:49.762 MySensors: Gateway Ready...
    2017-11-07 14:28:49.763 MySensors: Gateway Version: 2.2.0-rc.1
    2017-11-07 14:28:50.763 MySensors: Gateway Version: 2.2.0-rc.1 
    

    ./configure --my-gateway=ethernet --my-port=5003

    Raspi is 192.168.178.66, running Domotics (standart ports) and MySensors gateway. It´s a test OS, all fresh installations, up to date. Domotics is not connected to my smart home atm to avoid any problems. All added is the MS-gateway.
    Sensor is a motion sensor at the Arduino Uno.

    The log parser and the serial protocol are the main sources. But if you haven't already, read the getting started guide. Reading that will give you the background needed to understand how things fit together.

    It is more the understanding of how sensor reading and sending data to the gateway is handled. In case of the BH1750 I have code which won´t need a libary, it´s very effective, very small. As I plan to combine sensors, less code would be fine to let a nano handle as much as possible. The links you provided should be very helpful setting up my own code after everything runs stable.

    There seems to be a lot of html code in that library. There shouldn't be any html code in a library. Where did you download it from and how did you download it? Maybe you accidentally saved the github html page instead of saving the (raw) library file?

    Argh, possible, as there was no zip archive I just right-clicked and saved from Github. I will try copy / paste instead^^. Was my DL -.-

    Have you seen the instructions and the example sketch at https://www.mysensors.org/build/light-bh1750 ? They are intended to provide all you need to get the sensor working, but we may have failed.

    I copied 1:1, assume my fault with downloading the libary causes the problem. Compiling works now

    I hope this helps. If you have further questions, just ask (but do read the instructions I linked first, they are intended to bring people up to speed as easily and quickly as possible so hopefully they'll save you some time)

    I will definitely read through, already read the "getting started" section, will continue with the protocol wiki.
    Btw, I just wanted to test if the problem of communicaton could be on the hardware side. I stopped the gateway on the RPI, and installed RF24 stuff from "http://tmrh20.github.io/RF24Installer/RPi/install.sh". Also used this before i found MySensors, to test the RPi/Arduino. With the getting started script, and RPi set to respond, I was not able to get a clean connection. The RPi was not able to send. The OS is, as I said, a fresh, updated install, only MS-gateway and Domotics are installed. I suspected the Rpi to cause the problem, switched the SD-card to the one with my running Domotics, installed also from "http://tmrh20.github.io/RF24Installer/RPi/install.sh" - and the Rpi was perfectly answering. Exact same hardware, only OS was switched. Maybe the problem is on the OS itself, If the information of Domotics do not give you a hint whats going wrong, I will reinstall the OS / MS / Domotics again.. Reinstall also did not solve the problem.



  • Have changed a screenshot. The Arduino is recognized as Repeater, however, the motion sensor does not show up. Arduino is running code from
    https://www.mysensors.org/build/motion 1:1.
    Connecting to serial port of the Arduino keeps showing:

    18146892 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    18148900 !TSM:FPAR:NO REPLY
    18148902 TSM:FPAR
    18148905 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    18150914 !TSM:FPAR:NO REPLY
    18150916 TSM:FPAR
    18150919 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    18152927 !TSM:FPAR:NO REPLY
    18152929 TSM:FPAR
    18152932 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    18154940 !TSM:FPAR:FAIL
    18154942 TSM:FAIL:CNT=7
    18154944 TSM:FAIL:PDT
    

    Also

    Serial.println(tripped);
    

    should occur every time the sensor is triggered. Does not show up, all I see is the quoted stuff. As soon as I run a simple trigger script on the Uno, I see the sensor works perfectly.

    2nd edit:
    copy/paste libaries of BT1750 did the trick, compiling now works. However, I have the same problem as with the light sensor:

    176452 TSM:FAIL:RE-INIT
    176454 TSM:INIT
    176461 TSM:INIT:TSP OK
    176463 TSM:FPAR
    176466 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    178475 !TSM:FPAR:NO REPLY
    178477 TSM:FPAR
    178480 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    180487 !TSM:FPAR:NO REPLY
    180489 TSM:FPAR
    180492 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    182499 !TSM:FPAR:NO REPLY
    182501 TSM:FPAR
    182504 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    184511 !TSM:FPAR:FAIL
    184513 TSM:FAIL:CNT=7
    184515 TSM:FAIL:PDT
    

    I also have the debug of the Raspi, which tells me
    [...]
    Client 0: 0;0;3;0;18;PING
    [...]
    which should be Domoticz. There is nothing else showing up.
    Domotics says it´s a repeater node, as on the motion sensor..


  • Mod

    @Inso since the sensor node gets stuck on finding parent, the loop will not be executed at all. So not seeing the "tripped" print isn't strange.

    About why it gets stuck on find parent: I have no idea unfortunately



  • @mfalkvidd
    Finally it works, thank you very much for your fast and detailed help!
    If someone else has the same problem : I exchanged the capacitor (had two old ones without number on it, now 47uf best China quality :D) which solved the problem. Seems with the old ones the voltage collapsed before sending all data, so ping worked, communication didn't. I btw need the capacitor also to get usable lux values from my bh1750, without its always the maximum lux value.


  • Mod

    @Inso great work. Thanks for reporting back.


 

344
Online

7.7k
Users

8.6k
Topics

92.4k
Posts