A newbie in the town!

Hi to everyone,

Only recently I started to really actively looking into building my own home automation, so as you can guess I am pretty noob in it … at least for now :wink: ! With whatever difficulty I had, I finally managed to install the latest version of the home assistant on my computer and get it up and running ! However, after first modification of YAML file and restarting the whole homeassistant, I noticed that my configuration log keeps writing errors;

Traceback (most recent call last):
File “C:\Users\Mehrdad\AppData\Local\Programs\Python\Python35\lib\site-packages\homeassistant\bootstrap.py”, line 157, in setup_component
result = component.setup(hass, config)
File "C:\Users\Mehrdad\AppData\Local\Programs\Python\Python35\lib\site-packages\homeassistant\components\mqtt_init
.py", line 238, in setup
client_cert, tls_insecure, protocol)
File “C:\Users\Mehrdad\AppData\Local\Programs\Python\Python35\lib\site-packages\homeassistant\components\mqtt_init_.py”, line 324, in init
self._mqttc.connect(broker, port, keepalive)
File “C:\Users\Mehrdad\AppData\Roaming.homeassistant\deps\paho\mqtt\client.py”, line 685, in connect
self.connect_async(host, port, keepalive, bind_address)
File “C:\Users\Mehrdad\AppData\Roaming.homeassistant\deps\paho\mqtt\client.py”, line 743, in connect_async
if keepalive < 0:
TypeError: unorderable types: NoneType() < int()
16-08-31 11:09:29 mysensors.mysensors: Unable to connect to /dev/ttyACM0
16-08-31 11:09:29 mysensors.mysensors: Unable to connect to /dev/ttyUSB0
16-08-31 11:09:29 homeassistant.components.recorder: Ended unfinished session (id=4 from 2016-08-31 09:56:10.638415)
16-08-31 11:09:29 homeassistant.components.recorder: Found unfinished sessions
16-08-31 11:09:30 mysensors.mysensors: Failed to connect to socket at (‘192.168.1.65’, 5003).
16-08-31 11:09:39 mysensors.mysensors: Unable to connect to /dev/ttyACM0
16-08-31 11:09:39 mysensors.mysensors: Unable to connect to /dev/ttyUSB0
16-08-31 11:09:41 mysensors.mysensors: Failed to connect to socket at (‘192.168.1.65’, 5003).
16-08-31 11:09:49 mysensors.mysensors: Unable to connect to /dev/ttyACM0
16-08-31 11:09:49 mysensors.mysensors: Unable to connect to /dev/ttyUSB0
16-08-31 11:09:50 netdisco.ssdp: Found malformed XML at http://192.168.1.86:2871/dms.xml: <?xml version="1.0" encoding="utf-8"?>

1
0

Can one of you guys please spare me some minutes to help me to pass this error ? Also, I I am little bit confused about the whole hierarchy of setting things up in my homeassistant. I would really appreciate if someone can tell me what are the steps to be able to read a data from a temp sensor that is connected to my arduino nano and its radio module.

Again apologies for possibly wasting your time by asking silly simple questions ! I promise, once I get into swing of things I will help another newbie like myself :slight_smile:

Cheers,
Mehrdad

Welcome!

I’m not sure if I can help because I don’t use mysensors sensors, but the first step would be to post your configuration.yaml file (after scrubbing it and replacing any personal data or passwords with the word REDACTED) here and that way we can all get a look at it. WHen you post it, make sure you use the preformatted text option so it will appear here just like you typed it.

A lot of the time - especially when you are new to this - it’s simple error in YAML formatting; a missing colon or the wrong indent. So another thing you can check on your own is to run it through an online syntax checker. Just google “Online YAML syntax checker”.

1 Like

Hi rpitera ,

Thank you for your reply. I came across homeassistant from mysensors website, which I really hope I manage to learn how to use it. Below is the copy of my YAML. I was hoping that as an initial step, homeassistant can discover my chromecast which is on the same network.

Maybe a dumb question, but can homeassistant communicate with arduino boards through nRF24L01+ modules ? or putting simply, can I switch a light on/off which is connected to my arduino by using homeassistant (given that I already know how to do it by using relays and programming the arduino itself)?

Looking forward to hearing back from you,

`homeassistant:
# Name of the location where Home Assistant is running
name: REDACTED
# Location required to calculate the time the sun rises and sets
latitude: REDACTED
longitude: REDACTED
# Impacts weather/sunrise data
elevation: 0
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: REDACTED

# Show links to resources in log and frontend
introduction:
# Enables the frontend
frontend:

http:
  # Uncomment this to add a password (recommended!)
   api_password: 

# Checks for available updates
updater:

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time.
history:

# View all events in a logbook
logbook:

# Track the sun
sun:

# Weather Prediction
sensor:
  platform: yr

  # Example configuration.yaml entry
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: REDACTED
      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`

Well, like I said, I don’t have any experience with mysensors, but I did find a few threads that might help out:

This one on our forums:

And then this is a search for everything mysensors related in the forums:

https://community.home-assistant.io/search?q=mysensors

Hope this helps!

I don’t know about the arduino boards, but I’d be surprised if this wasn’t support as I see mentions of it in the forums. To be honest, I’m not really a hardware hacker. I’ve considered it, but my electronics skills and understanding are sorely lacking.

I’m hoping somewhere down the line I’ll try something with this since a lot of HA users make their own sensors so there should be people here who can help.

Thank you so much for your help. I had a look on all the links, but sadly, I haven’t managed to pass my error … I wish there was one single simple tutorial (or even a flowchart or bullet points) from start to end showing how one can setup a sensor + arduino + homeassistane .

What I found a bit confusing is that, there are so many different releases and versions which may not work well with one another …

Short story … I am still struggling to setup my homeassistant !

hey @mehrdad.silatani,

sorry if I’m asking something already shared but…

based on the config above looks like you’re using 4 differenc gateways (USB, MQTT and others and also based on the error message you can’t connect to dev/ttyACM0, dev/ttyUSB0 and something is weird with the MQTT.

Can you please share some more details?

  • how many GateWays you have?
  • Type (Ethernet, USB)??

let’s start with this and see if we can help.

1 Like

Hi davedan !

No need for apology, at the stage I am at, any question is a new lesson for me … So in fact thanks for taking time to help me !

Answering your questions;

  1. Gateways: one … I think I only have one gateway (the reason I said one is that, there is only one arduino board and one nRF24L01+ module currently active)

  2. Type : USB … the Arduino board is connected to my laptop with a USB cable.

Ok, cool …

this is a great start … let’s confirm one more thing.

Did you use this (https://www.mysensors.org/build/serial_gateway) instructions to build it?

Thanks for checking in @davedan; I’m a bit over my head!

Awesome !

Yes, exactly. But one thing to note is that, in that demonstration video, they use an older version of the serialgateway code … I used the updated version that is named " GatewaySerial" in mysensor V2 library.

Sorry for the delay in responding, had to answer a phone call.

I think the Serialgateway is working properly on the arduino side;

Ok, cool …

so you have a Serial Gateway that is working (or at least looks like that) with Version 2.0.

so, 1st thing. in the configuration section please remove everything except the Serial USB Configutation.

If you check in here: https://home-assistant.io/components/mysensors/ you will find all the available configs. You just need the one for USB. Should be something like this:

mysensors:
gateways:
- device: ‘/dev/ttyUSB0’
persistence_file: ‘path/mysensors.json’
baud_rate: 38400
debug: true
optimistic: false
persistence: true
retain: true
version: 2.0

(check indentation)
once updated please restart HA and check the logs to find the initial negotiation between the MySensors GW and HA.

do you have any sensor connected to the GW? would be great to check if messages are getting in or not.

1 Like

I am on it, give me 5 mins …

I will hook up a simple temp sensor … now that I said it, how do I tell my arduino to pass on the readings from the sensor to the gateway ? should I add a specific code line?

Ok, to start with; I changed my yaml file as you suggested. But still I get similar error;

What is “mysensors.json” ? It seems it is missing and thus it causes serious error …

That’s where the persistence of the mysensors sensors is stored. You need to create a file (the process much be able to read and write on it) and update the configuration with the correct path.

Check that and let’s take another look to the logs.

QQ: platform you’re using? Linux, windows?

Looking at your log errors above looks like you’re in windows. Please ensure both the USB port and the path are in windows standards:

mysensors:
gateways:
- device: ‘COM4’
persistence_file: ‘c:/example/mysensors.json’

Never tested this but should work … I hope :slight_smile:

1 Like

Hay dave !

One step forward ! Yay ! now following your suggestion, HM finds the arduino, but it comes up with an error while tries to interpret the data from sensor … So I think, USB port is sorted, but “mysenosrs.json” is still a problem. How do you advise to continue ?

I did as you suggested, I made an empty accessible txt file with the exact name and suffix of “mysensors.json” … but still no luck

Just to add; I am using the “lightsensor” IDE from mysensors V 2 library … And as a light sensor, I connected a photoresistor …

You don’t need to create the persistence file yourself. You just need to make sure that the path to the persistence file in your home assistant configuration.yaml leads to a directory that exists on your computer and that home assistant can write to that directory. The first time a mysensors sensor reports a value, home assistant will create the persistence file.

Regarding the error to decode the message from the gateway: Make sure that only home assistant is connected to the usb serial gateway device. The serial connection is exclusive, meaning that there will be a problem if two programs try to connect and read from the same serial device at the same time. For example, you can’t have the Arduino IDE serial monitor connected to the gateway at the same time as home assistant is running.

Hi Martin,

Thanks for helping me out. About the points you raised, I changed the presistence_file to:

  persistence_file: 'C:\mysensors.json'

And I still get the error that such file doesn’t exist or it is not readable.So I think now what can be the cause, is that the sensor is not reporting any value which in turn will trigger the HA to create that “mysensors.json” file …

Also, I triple checked and there is no other program that is trying to use same gateway as the HA …