Getting started



  • Hi all!

    I'm just about to get my first sensor readout to Home Assistant but something is wrong and I need your help.

    I now have Home Assistant running on Raspberry Pi 3 and an Arduino Uno acting as a serial gateway flashed with the example gateway sketch. And one sensor node on Pro Mini with DHT22 attached and flashed with the example DHT sketch.

    From examining the logs I can see that Home Assistant is able to connect to the gateway:
    2017-11-14 22:35:03 INFO (Thread-13) [mysensors.gateway_serial] Trying to connect to /dev/ttyACM0
    2017-11-14 22:35:03 INFO (Thread-13) [mysensors.gateway_serial] /dev/ttyACM0 is open...
    2017-11-14 22:35:03 INFO (Thread-13) [mysensors.gateway_serial] Connected to /dev/ttyACM0

    And I can see that the gateway is talking to Home Assistant
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.0
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:WUR:MS=0
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT:TSP OK
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT:GW MODE
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:READY:ID=0,PAR=0,DIS=0
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:REG:NOT NEEDED
    2017-11-14 22:35:05 INFO (Thread-13) [mysensors] n:0 c:255 t:3 s:14 p:Gateway startup complete.
    2017-11-14 22:35:05 DEBUG (Thread-13) [homeassistant.components.mysensors] Node update: node 0 child 255
    2017-11-14 22:35:05 DEBUG (Thread-13) [homeassistant.components.mysensors] Not a child update for node 0
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] Handle queue with call <bound method SerialGateway.logic of SerialGateway>(('0;255;0;0;18;2.1.0\n',), {}) took 0.190 seconds
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:STP
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:INIT OK,TSP=1
    2017-11-14 22:35:05 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:

    But after this all that happens is that this goes on over and over
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:39.6
    2017-11-14 22:45:27 WARNING (Thread-13) [mysensors] Node 1 is unknown
    2017-11-14 22:45:27 INFO (Thread-13) [mysensors] Requesting new presentation for node 1
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:!TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=19,pt=0,l=0,sg=0,ft=0,st=NACK:
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.0
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:WUR:MS=0
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT:TSP OK
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT:GW MODE
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSM:READY:ID=0,PAR=0,DIS=0
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:REG:NOT NEEDED
    2017-11-14 22:45:27 INFO (Thread-13) [mysensors] n:0 c:255 t:3 s:14 p:Gateway startup complete.
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:STP
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:INIT OK,TSP=1
    2017-11-14 22:45:27 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:

    Here is my HA configuration:

    mysensors:
      gateways:
        - device: '/dev/ttyACM0'
          baud_rate: 115200
          persistence_file: '/home/homeassistant/.homeassistant/mysensors2.json'
      optimistic: false
      persistence: true
      version: 2.0
      
    logger:
      default: info
      logs:
        homeassistant.components.mysensors: debug
        mysensors: debug
    

    And the contents of the "mysensors2.json" persistence file

    {"0": {"sketch_name": null, "children": {}, "sensor_id": 0, "battery_level": 0, "sketch_version": null, "type": 18, "protocol_version": "2.1.0"}}
    

    So what should I investigate next? Is there perhaps something missing from the example from https://www.mysensors.org/build/humidity ?

    In the example there is defined only child ID's not the node ID's. Shouldn't these come from the controller (HA) ?

    Thanks for your help, I hope you my explanations make sense.


  • Mod

    I'd try to assign a node id in code and see if it works better, later you can investigate how to do auto assign



  • Hi!

    I managed to get the node to work by rebooting everything. Maybe the controller and gateway must be alive before the sensor send its presentation?

    But thanks for the help anyway!

    I'm exited to start building my homeautomation now that I have all the connection working from end to end.

    The first task is to replace my room thermostats with intelligent ones but I think I'll continue it in a different topic.

    Mikko


  • Plugin Developer

    @Misna

    Yes, the controller and gateway needs to be running the first time your present a node and sensor.

    You also might want to look into the power supply and stability of your gateway, since it seemed to reboot when it sent the request for new presentation.



  • @martinhjelmare The gateway (Uno) is powered from the USB port of the RPi3 which runs Home Assistant. Should I use a external power supply?


  • Plugin Developer

    @Misna

    Yes, I would recommend that. From personal experience computer usb powered unos are unstable. Make sure you have a capacitor close to the radio, as recommended in the radio guide on the mysensors site, too.



  • @martinhjelmare ok, I'll get a proper power supply. I have a capasitor welded to the radio module. The gateway has the model with the stick antenna.

    I have tried how far the demo sensor node works (it has the std module with the antenna on the PCB) and it works anywhere in my 3 story house.
    But when I moved it to a building next to my house it didn't work. The distance was maybe 40m.

    Should I experiment with the setting #define MY_RF24_PA_LEVEL ?
    What does this require from the HW?


  • Mod

    @Misna said in Getting started:

    stick antenna.

    Is it a PA LNA version?
    Btw I guess it is normal that a normal nrf24 can't reach between 2 buildings that far. If you can use 2 PA LNA radios it should work better



  • You can of course try pa level max. It might help. As @gohan said, the pa/lna version would also help in this situation. You can also try directional antenna yagi to maximise power in the direction you want it to go (fairly cheap on ebay).

    What is between the buildings? 40m of free space?

    Also think about using the 5V power from the uno and going via a buck converter (or any linear or switching voltage regulator) down to 3.3v - the arduino 3.3v supply is notorious for being 'noisy'..



  • @skywatch There is maybe 30m between the buildings and the gateway is on the other side of my house so 10m of indoor space and lots of walls...

    Yes the gateway has the PA LNA version. I guess it's ok to mix these?

    I'm taking 5V from the UNO to RF module via this adapter: https://www.aliexpress.com/item/New-Socket-Adapter-plate-Board-for-8Pin-NRF24L01-Wireless-Transceive-module-51/32655936568.html?spm=a2g0s.9042311.0.0.IAzDGk

    I'm planning to maybe place a couple of nodes to the outside wall of my house so maybe using these as repeaters might solve the problem..

    At the moment I only have one PA LNA version but I'm about to place an order this weekend.


  • Mod

    Your only option is to have repeaters



  • Here are the directional antenna yagi arrays. You need one each end for best range and they need to be able to 'see' each other (no metal buildings in the way)

    https://www.ebay.co.uk/itm/2-4GHz-13DBI-15DBI-Yagi-WLAN-WiFi-Wireless-Antenna-for-Router-A1Q5/112448960487?epid=2078505269&hash=item1a2e7af7e7:g:HhIAAOSwwzhZSDda

    Wiht two of these and 2 pa/lna boards you should get many km in open space!!!

    hth


  • Mod

    The problem is that you would use signal around that antenna if you have other sensors in the building



  • @gohan,

    My intention was for @minsa to use this only for the long range link, the receiving pro=mini could be a gw for the garage sensor(s). Everything else would remian the same.



  • @skywatch So I would have 2 gateways? One for indoor sensors and one for outdoor sensors?

    Would it be possible to have NRF24 and RFM69 chips on the same gateway?
    So I could use the RFM69 with nodes that are farther away?



  • @Misna Look at the Sensebender Gateway...



  • @Misna

    Adding a gateway means that your current system stays the same and is not changed in any way - so you have time to experiment with the new additions.

    I have never used rfm69 so can't say on those, sorry.

    I will say that you probably can't have 2 radios on one gw. But it might be possible.
    With MyController you can have multiple gateways for the controller and that is what you will need.
    As per above, I would just add another pro mini to act as a second gw for the longer range testing as that will not impact on your current setup.



  • @skywatch said in Getting started:

    e 2 radios on one gw. But it might be possible.

    At least by now, one can only use one transport layer per Node/Gateway.


  • Mod

    @Misna said in Getting started:

    stick antenna.

    Is it a PA LNA version?
    Btw I guess it is normal that a normal nrf24 can't reach between 2 buildings that far. If you can use 2 PA LNA radios it should work better

    you can compile and run 2 different instances of the raspberry gateway in 2 separate folders. There is an openhardware project for a raspberry hat



  • @gohan ok but at the moment the gateway runs on Arduino Uno. So I have to switch to RasPi?
    Or can I buy another Uno and use RFM69 with it? But does Home Assistant support multiple MySensors gateways?


  • Mod

    You can't do it on an arduino. Since you are going to run a controller it could make sense having a raspberry. Running 2 separare instances it would not be a problem for HA as you would have to add the 2 gateways anyway like if they were on separate hw


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 8
  • 3
  • 17
  • 2

59
Online

11.4k
Users

11.1k
Topics

112.7k
Posts