Struggling with configure.yaml



  • Hi all. Bordering on suicidal, please help.

    Pi 3 with all in one (raspian lite - mosquitto - home assistant) installed
    NodeMCU 1.09 wireless GW with nrf2401+ radio.
    arduino nano clone mysensors relay. v2 node

    Node talks to GW ok
    GW talks to node ok
    GW talks to mosquitto ok
    mosquitto talk to GW ok
    Home assistant boots up with :8123 ok
    getting HA to find sensors, configure configure.yaml...... NOT OK
    because of this, no GW to HA communication.

    How I managed the above, I really have no idea. I am one of the mugs that believed the arduino hype. "No coding experience required, cut and paste, simple"..... What a load of tripe. lol. I now know a little bit about alot of areas but now and again I just hit a wall. I cannot get my head around how to configure the configure.jaml file. Every time I try it crashes the browser socket.

    A simple working example and I will be away and learn from there. I feel like a dumb blonde on this but I swear, if you guys don't help me out, I am putting the wife in the garden shed for the rest of the winter.

    Thanks in advance.



  • @el-tigro

    Ok. How would I configure the example from HA to my setup?? many thanks.

    mysensors:
    gateways:
    - device: '/dev/ttyUSB0'
    persistence_file: 'path/mysensors.json'
    baud_rate: 38400
    - device: '/dev/ttyACM0'
    persistence_file: 'path/mysensors2.json'
    baud_rate: 115200
    - device: '192.168.1.18'
    persistence_file: 'path/mysensors3.json'
    tcp_port: 5003
    - device: mqtt
    persistence_file: 'path/mysensors4.json'
    topic_in_prefix: 'mygateway1-out'
    topic_out_prefix: 'mygateway1-in'
    debug: true
    optimistic: false
    persistence: true
    retain: true
    version: 2.0



  • @el-tigro

    I assume the above example is instructions for 4 devices, 1 being mqtt broker.

    what is - device: '/dev/ttyUSB0' and how does it identify the device? It looks like a path to a destination file, where? what is it?

    how many of the 4 sets of instructions are relavent to my setup and which if any can i drop? Mqtt to stay

    how do I identify, what do i need to identify / present for my wireless gateway and node?

    thanks again.


  • Plugin Developer

    @el-tigro

    Hi!

    Since you only have one mqtt arduino gateway you only need one device entry in your mysensors home assistant config. Keep the one called mqtt. This will set up home assistant to try to use a mqtt client to interface with the mysensors component which handles the mysensors - home assistant logic.

    Make sure you read how to configure the topic prefixes in the gateway and note those and then use those when you configure the mqtt device in the mysensors home assistant config. Otherwise the gateway cannot talk to home assistant. There's a good tutorial on the mqtt client gateway in the forum here.

    https://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway

    You also need to set up the mqtt component in home assistant. Here you will configure the mqtt client to connect to the correct mqtt broker address. You can read more about the mqtt component in the home assistant docs.

    https://home-assistant.io/components/mqtt/

    This is basically what you need for mysensors config.

    mysensors:
      gateways:
        - device: mqtt
          persistence_file: 'path/mysensors4.json'
          topic_in_prefix: 'mygateway1-out'
          topic_out_prefix: 'mygateway1-in'
      debug: true
      optimistic: false
      persistence: true
      retain: true
      version: 2.0
    

    Of course you have to replace path for the persistence file with a real path to a folder that exists and that home assistant can write to. The config directory is usually good. You don't need to create the actual persistence file. It will be created when the first sensors are added.

    PS
    The other devices in the example config you posted are examples of other types of gateways that can be used together with home assistant. There's the serial gateway and the ethernet gateway. The ethernet gateway takes an ip address and a port number and the serial gateway takes a path to the serial port that the gateway is connected to, this is usually under /dev/ on a Linux host. You can also set the baud rate on the home assistant side for the communication over the serial connection.



  • Firstly, thanks for replying, you are at present, my only contact with hope. Hey..come back don't run away. lol.

    Once I get one working node, I can start to disect how it's done and apply (hopefully) to the next node, that's my funked up way of doing things. I am getting confused now, my gateway is an ESP8266 (NodeMCU) and my nodes are arduino.

    My brain fart is understanding the device identification system, terms and syntax so to speak.

    • device: '/dev/ttyUSB0'

    it means nothing to me other than a pointer, to something. That something, makes somebody's config work based on their setup. In the terms/syntax used above, I have no idea what I have, where to point to and what i need to tell it to do or tell it to do.

    No info, i can find, point's towards (or am I blinded) my wireless gateway and connecting to HA.

    I feel like I am trying to make a cake, I know I have all the ingredients right, everything is weighed out correct, I followed all the recipe-ish, but still it remains gooey. I do it over and over and still the same result, gunky mess, no cake. Then I realise I farted at the little 1 liner about turning the oven on and missed it.

    any help or pointers appreciated.



  • wow, your message grew as I was writing, I will try what you suggested now, thanks


  • Plugin Developer

    Sorry I shouldn't have said arduino gateway. It's a nodeMCU as you said or ESP.

    You only need to make sure that the gateway can talk to home assistant, since you say that everything else works. And you want to use mqtt for this connection, right? So don't bother with the serial gateway path, /dev/... . That's only for a serial gateway. You want to use a mqtt client gateway. Follow what I wrote above and read the corresponding doc and forum pages I linked.



  • Some progress, probably me not understanding.

    firstly, my humble apologes if I come across as thick. 2 weeks ago I was playing with arduino IDE and NRF24 libraries. To me Linux was a nerd code, way above me and cmd prompt was chinese.

    is my persistence part right? It is the same path I take to configure.yaml

    mysensors:
      gateways:
        - device: mqtt
          persistence_file: 'home/homeassistance/.homeassistance/mysensors4.json'
          topic_in_prefix: 'mygateway1-out'
          topic_out_prefix: 'mygateway1-in'
      debug: true
      optimistic: false
      persistence: true
      retain: true
      version: 2.0
    

    I left the pub/sub part as is, content can come later.... I assume.

    Good and bad results.
    Home assistant socket :8123 stays up (crashed every time for me) but shows errors.

    Invalid config
    The following components and platforms could not be set up:
    
        mysensors
        mqtt
    
    Please check your config 
    

    Is my syntax correct?

    I have been looking at the work you put in and your result, some folk deserve a drink. Do you have paypal details?


  • Plugin Developer

    To really be able to check the formatting of the config, you should post your config within codeblock markdown here in the forum. That's three back-tics, newline, code, newline, three back-tics. Then you'll get a black box with the code/config like I posted above, and formatting will be retained. Indentation is very important for yaml syntax.

    Other than that it seems you have a non standard spelling of "homeassistant" in the path for the persistence file. My guess is that is a typo, at least for the hidden directory that start with a period.

    But the most important part is that you don't say that you've configured the mqtt component. Did you do that? You should have a separate entry in the config with

    mqtt:
    

    and under that the broker ip etc.

    Thanks for the virtual beer! 😄 This is my hobby and it's super fun. You learn a lot. The great feedback you get from the community is reward enough for me.

    PS there are many that helped build the mysensors component in home assistant, and it's based on two super communities.



  • This post is deleted!


  • This post is deleted!


  • @el-tigro said:

     mysensors:
       gateways:
         - device: mqtt
           persistence_file: 'home/homeassistant/.homeassistant/mysensors4.json'
           topic_in_prefix: 'mygateway1-out'
           topic_out_prefix: 'mygateway1-in'
       debug: true
       optimistic: false
       persistence: true
       retain: true
       version: 2.0
    

    Good morning from blighty. I retained your format and indentations, I think. Sorry for typo's, it was 1am and a few southern comforts. The hidden .homeassistant folder, was part of install and is where my config file lives, is that not good.

    You are exposing my dumb ass here lol, i thought we just configured the '-device :mqtt'.
    This is from HA website for mysensors but all I can see to configure is the boker IP. I tried it along with the previous code.... same error.

    Where I come from, it's rude not to accept a drink between men and I don't mean a virtual drink. Your service and assistance is invaluable to me and the least I could do is slide you a bottle of Southern Comfort. So stop being humble, stop being rude and email me an paypal addy.

     mqtt:
       broker: IP_ADDRESS_BROKER
       port: 1883
       client_id: home-assistant-1
       keepalive: 60
       username: USERNAME
       password: PASSWORD
       certificate: /home/paulus/dev/addtrustexternalcaroot.crt
       protocol: 3.1
       birth_message:
         topic: 'hass/status'
         payload: 'online'
         qos: 1
         retain: true
       will_message:
         topic: 'hass/status'
         payload: 'offline'
         qos: 1
         retain: true
    

    looked for a path to certificate...... no idea there. Tried leaving in and without

    my mosquitto mqtt has no username or pw at the moment. Tried leaving in and without.

    Once again I am at your mercy lol


  • Plugin Developer

    You are missing a leading slash for the path to the persistence file, ie before home.

    Try a minimal config for the mqtt component:

    mqtt:
      broker: IP_ADDRESS_BROKER
      client_id: home-assistant-1
    

    Of course, replace IP_ADDRESS_BROKER with your real mqtt broker ip address.

    Sorry I don't wish to be rude, but I don't want to accept any money. If you want to donate, mysensors.org has a donate with paypal button. This will help keep the site hosting alive etc and support the community.



  • mysensors:
      gateways:
        - device: mqtt
          persistence_file: '/home/homeassistant/.homeassistant/mysensors4.json'
          topic_in_prefix: 'mygateway1-out'
          topic_out_prefix: 'mygateway1-in'
      debug: true
      optimistic: false
      persistence: true
      retain: true
      version: 2.0
    
    mqtt:
      broker: 192.168.1.115
      client_id: home-assistant-1
    

    is giving the same

    Invalid config
    The following components and platforms could not be set up:
    
        mysensors
        mqtt
    
    Please check your config 
    

    To clarify in my head, everything that is connected to HA needs a block in config with minimum set of data but can be finely tuned with further commands if need be.
    If this is the case, how is the gateway identified in the first block of code.

    To make sure I am not mis-reading debug, this is my arduino nano node

    Starting repeater (RNNRA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=1)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:CHKUPL:OK
    TSM:UPL:OK
    TSM:READY
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
    TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=18,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
    TSP:MSG:READ 0-0-1 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=ok:Relay+button
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0
    TSP:MSG:SEND 1-1-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    Request registration...
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
    TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1
    Node registration=1
    Init complete, id=1, parent=0, distance=1, registration=1
    Sending initial value
    TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:0
    Requesting initial value from controller
    

    This is My gateway

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGE--,VER=2.1.0
    0;255;3;0;9;TSF:LRT:OK
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    scandone
    no BTHub5-C2FC found, reconnect after 1s
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    reconnect
    f 0, 0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    scandone
    f -180, ....scandone
    no BTHub5-C2FC found, reconnect after 1s
    reconnect
    f r0, ....scandone
    no BTHub5-C2FC found, reconnect after 1s
    reconnect
    f 0, .....scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 1
    cnt 
    .0;255;3;0;9;TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=1
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    
    connected with BTHub5-C2FC, channel 6
    dhcp client start...
    0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    ..ip:192.168.1.117,mask:255.255.255.0,gw:192.168.1.254
    .IP: 192.168.1.117
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    IP: 192.168.1.117
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;TSF:MSG:PINGED,ID=1,HP=1
    0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=0,t=18,pt=0,l=5,sg=0:2.0.0
    0;255;3;0;9;Sending message on topic: mygateway1-out/1/255/0/0/18
    0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
    0;255;3;0;9;Sending message on topic: mygateway1-out/1/255/3/0/6
    

    And here is broker

    login as: pi
    pi@192.168.1.115's password:
    
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    Last login: Thu Jan 19 22:04:56 2017
    pi@raspberrypi:~ $ mosquitto -v
    1484863517: mosquitto version 1.3.4 (build date 2014-08-22 06:10:51+0000) starting
    1484863517: Using default config.
    1484863517: Opening ipv4 listen socket on port 1883.
    1484863517: Opening ipv6 listen socket on port 1883.
    1484863518: New connection from 192.168.1.117 on port 1883.
    1484863518: New client connected from 192.168.1.117 as mysensors-1 (c1, k15).
    1484863518: Sending CONNACK to mysensors-1 (0)
    1484863518: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/0/255/0/0/18', ... (5 bytes))
    1484863518: Received SUBSCRIBE from mysensors-1
    1484863518:     mygateway1-in/+/+/+/+/+ (QoS 0)
    1484863518: mysensors-1 0 mygateway1-in/+/+/+/+/+
    1484863518: Sending SUBACK to mysensors-1
    1484863518: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863519: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863520: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863520: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863522: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863522: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863524: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863524: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863526: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863526: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863528: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863528: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863530: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863530: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863532: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/1/0/2', ... (1 bytes))
    1484863532: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1/1/2/0/2', ... (0 bytes))
    1484863534: Received PINGREQ from mysensors-1
    1484863534: Sending PINGRESP to mysensors-1
    

    It won't matter that my broker and HA are on the smae pi will it.

    Your a rare breed fella, don't let the wifey know ya refusing $$ lol. Will make a donation.... if ya sort me out.



  • Should my gate gateway sketch have presentation details in it, coz it doesn't. I removed comments to reduce size.

    /**
    
     * The ESP8266 MQTT 
    
    #include <EEPROM.h>
    #include <SPI.h>
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    #define MY_BAUD_RATE 9600
    #define MY_RADIO_NRF24
    #define MY_GATEWAY_MQTT_CLIENT
    #define MY_GATEWAY_ESP8266
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
    #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
    #define MY_MQTT_CLIENT_ID "mysensors-1"
    #define MY_ESP8266_SSID "BTHub5-C2FC"
    #define MY_ESP8266_PASSWORD "xxxxxxxxx"
     #define MY_ESP8266_HOSTNAME "mqtt-sensor-gateway" ///
    #define MY_CONTROLLER_IP_ADDRESS 192,168,1,115
    #define MY_PORT 1883      
     /*
    // Flash leds on rx/tx/err
    #define MY_LEDS_BLINKING_FEATURE
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60 
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  3 
    
    #define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
    */
    
    #include <ESP8266WiFi.h>
    #include <MySensors.h>
    
    void setup() { 
    }
    
    void presentation() {
      // Present locally attached sensors here    
    }
    
    
    void loop() {
      // Send locally attech sensors data here
    }
    
    
    
    
    

  • Plugin Developer

    Since your mqtt broker and home assistant is on the same host, you should use localhost or "127.0.0.1" as broker address when setting up the mqtt component in home assistant. Home assistant and mosquitto (MQTT) use different ports so there shouldn't be a conflict.

    mqtt:
      broker: localhost
      client_id: home-assistant-1
    

    The gateway is identified by home assistant via the prefix topics, in the case of the mqtt gateway.

    Arduino + ESP sketches and logs look ok.



  • Same same, no different i'm affraid. It's pissing me off now, more because I don't understand enough to do more for myself. I think this is going to be shelved for a while.
    I am talking about the wifi gateway,

    I am gonna stick with HA and mysensors but rehash my hardware. I have PI's , Nano's, Yun, Mini's and ESP8266's. What combination / configuration would you recommend for ease of setup.

    Gonna try running mosquiito on a seperate Pi to HA first off.


  • Plugin Developer

    Do you get any other errors in the log? It would be interesting to see a log after start of home assistant.

    An RPi for controller, a Nano as serial gateway and Pro Minis as sensors, I'd say should be the most easy and "mainstream".

    But easy is a relative term. Remember that we're building our own wireless IoT devices and home automation setup. Most people might not call that easy at all. Although I think mysensors lowers the difficulty bar considerably in this context.



  • Hi again.

    here is my home-assistant.log

    fingers double crossed

    
    pi@raspberrypi:/home/homeassistant/.homeassistant $ less home-assistant.log
    17-01-23 19:36:57 homeassistant.components.mqtt: Can't connect to the broker. Please check your settings and the broker itself
    Traceback (most recent call last):
      File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/__init__.py", line 262, in setup
        birth_message)
      File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/__init__.py", line 351, in __init__
        self._mqttc.connect(broker, port, keepalive)
      File "/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py", line 686, in connect
        return self.reconnect()
      File "/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py", line 808, in reconnect
        sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
      File "/usr/lib/python3.4/socket.py", line 509, in create_connection
        raise err
      File "/usr/lib/python3.4/socket.py", line 500, in create_connection
        sock.connect(sa)
    ConnectionRefusedError: [Errno 111] Connection refused
    17-01-23 19:36:57 homeassistant.bootstrap: component mqtt failed to initialize
    17-01-23 19:36:57 homeassistant.bootstrap: Component mqtt failed to setup
    17-01-23 19:36:57 homeassistant.components.mysensors: No devices could be setup as gateways, check your configuration
    17-01-23 19:36:57 homeassistant.bootstrap: component mysensors failed to initialize
    17-01-23 19:36:57 homeassistant.components.mqtt: Can't connect to the broker. Please check your settings and the broker itself
    Traceback (most recent call last):
      File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/__init__.py", line 262, in setup
        birth_message)
      File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/__init__.py", line 351, in __init__
        self._mqttc.connect(broker, port, keepalive)
      File "/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py", line 686, in connect
        return self.reconnect()
      File "/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py", line 808, in reconnect
        sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
      File "/usr/lib/python3.4/socket.py", line 509, in create_connection
        raise err
      File "/usr/lib/python3.4/socket.py", line 500, in create_connection
        sock.connect(sa)
    ConnectionRefusedError: [Errno 111] Connection refused
    17-01-23 19:36:57 homeassistant.bootstrap: component mqtt failed to initialize
    
    


  • OK. we are in, no errors in HA but have this in HA log.

    17-01-23 22:19:55 mysensors.mysensors: File does not exist or is not readable: /home/homeassistant/mysensors4.json
    17-01-23 22:19:55 mysensors.mysensors: Trying backup file: /home/homeassistant/mysensors4.json.bak
    17-01-23 22:19:55 mysensors.mysensors: File does not exist or is not readable: /home/homeassistant/mysensors4.json.bak
    17-01-23 22:19:55 mysensors.mysensors: Failed to load sensors from file: /home/homeassistant/mysensors4.json
    

    I have tried a few file path but always the same.



  • Well, the sun shines on a dogs arse some days.

    We've only gone and done it, HA dash with relay sw. can controll led from dash. I honestly have sticky stuff running down my leg. You have no idea how happy I am.

    For future reference.
    I was flicking the power to reset pi in between config changes. My mosquitto was not starting from boot, so nothing to connect to, hence the errors when the code was right.
    Also reset your nodes after a change.

    This my yaml for the following setup

    nodes are arduino nanos with nrf2401+ radio. (mysensors 2.0)

    gateway is esp8266 NodeMCU 1.09. Wifi with NRF2401+

    Pi 3 hosts Home Assistant and Mosquitto broker. Installed with All in one image.

    mysensors:
      gateways:
        - device: mqtt
          persistence_file: '/home/homeassistant/mysensors4.json'
          topic_in_prefix: 'mygateway1-out'
          topic_out_prefix: 'mygateway1-in'
      debug: true
      optimistic: false
      persistence: true
      retain: true
      version: 2.0
    
    mqtt:
      broker: localhost
      port: 1883
      client_id: home-assistant-1
      keepalive: 60
    

    Righty. I'm off to play. Be back very soon when i get stuck.

    Cheers for now fella, thank you for all your help.


Log in to reply
 

Suggested Topics

63
Online

11.4k
Users

11.1k
Topics

112.7k
Posts