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. Controllers
  3. Home Assistant
  4. 'Bad byte' error

'Bad byte' error

Scheduled Pinned Locked Moved Home Assistant
34 Posts 2 Posters 8.2k Views 2 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.
  • ? A Former User

    Hi.

    I have justed connected my USB mysensors gateway. But im getting the 'bad byte' error. At first i didnt know that i should had installed the pyserial. But still after the install to pyserial 3.0.1. Im still getting the 'bad byte' error can some help, this is the log.

    6-03-12 01:20:43 mysensors.mysensors: Trying to connect to /dev/ttyUSB1
    16-03-12 01:20:43 mysensors.mysensors: /dev/ttyUSB1 is open...
    16-03-12 01:20:43 mysensors.mysensors: Connected to /dev/ttyUSB1
    16-03-12 01:20:46 mysensors.mysensors: Error decoding message from gateway, probably received bad byte.
    
    martinhjelmareM Offline
    martinhjelmareM Offline
    martinhjelmare
    Plugin Developer
    wrote on last edited by
    #2

    @fleshfear

    Hi!

    Have you tried to keep running HA after the error to see if the next message comes through alright?

    For me this error usually goes away after a restart of HA.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #3

      Yes now the ha have been runing all night, with the gateway connected. And the 'bad byte' error is the last thing there is logge from mysensor.

      1 Reply Last reply
      0
      • martinhjelmareM Offline
        martinhjelmareM Offline
        martinhjelmare
        Plugin Developer
        wrote on last edited by martinhjelmare
        #4

        First try to disconnect and reconnect the usb to the arduino. Start hass. Make sure you connect to the correct port after reconnecting the usb. Sometimes the arduino will change port name.

        If this doesn't help try another version of pyserial. 2.5 has been the least buggy for me. You can also try 2.7.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #5

          I have tried connecthing and reconnecthing multiple times. But how do I down grade to 2.5, right now I have just installed 3.0.1?

          martinhjelmareM 1 Reply Last reply
          0
          • ? A Former User

            I have tried connecthing and reconnecthing multiple times. But how do I down grade to 2.5, right now I have just installed 3.0.1?

            martinhjelmareM Offline
            martinhjelmareM Offline
            martinhjelmare
            Plugin Developer
            wrote on last edited by
            #6

            @fleshfear

            pip3 install pyserial==2.5
            
            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #7

              now i have 2.5. But still no luck. What to do.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #8

                now i allso have this in my log

                16-03-12 19:45:33 mysensors.mysensors: Error decoding message from gateway, probably received partial data before connection was complete.
                
                martinhjelmareM 1 Reply Last reply
                0
                • ? A Former User

                  now i allso have this in my log

                  16-03-12 19:45:33 mysensors.mysensors: Error decoding message from gateway, probably received partial data before connection was complete.
                  
                  martinhjelmareM Offline
                  martinhjelmareM Offline
                  martinhjelmare
                  Plugin Developer
                  wrote on last edited by
                  #9

                  @fleshfear

                  Nothing else is accessing the serial port?

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #10

                    no that i know of. Its a virtual machine dedicated to only ha. And i have just testet if it was the virtual enviroment there was to blame. But on indigo domistic the plugin for mysensors works and can talk to the gateway.

                    Im i missing something else like pyserial or?

                    Is the only thing needed ha and pyserial?

                    1 Reply Last reply
                    0
                    • martinhjelmareM Offline
                      martinhjelmareM Offline
                      martinhjelmare
                      Plugin Developer
                      wrote on last edited by
                      #11

                      Have you rebooted the machine after installing pyserial 2.5?

                      You can also check that there's no remains of other pyserial versions where the python packages are installed on your machine.

                      What distribution are you running?

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #12

                        yep have rebooted, many times after that.

                        How do i check if there are any other version installed? I could not install pyserial just like you said, i had to run a

                        pip3 uninstall pyserial
                        

                        first.

                        it' a ubuntu 15.10

                        1 Reply Last reply
                        0
                        • martinhjelmareM Offline
                          martinhjelmareM Offline
                          martinhjelmare
                          Plugin Developer
                          wrote on last edited by
                          #13

                          Python library files on Ubuntu are usually found in:

                          /usr/local/lib/pythonX.X/site-packages
                          
                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #14
                            ls -la /usr/local/lib/python3.4/dist-packages/
                            homeassistant/                  MarkupSafe-0.23.egg-info/       pytz-2015.7.dist-info/          vincenty/
                            homeassistant-0.15.0.dist-info/ pip/                            PyYAML-3.11.egg-info/           vincenty-0.1.3.egg-info/
                            jinja2/                         pip-8.1.0.dist-info/            requests/                       yaml/
                            Jinja2-2.8.dist-info/           pyserial_py3k-2.5.egg-info/     requests-2.9.1.dist-info/       
                            markupsafe/                     pytz/                           serial/  
                            
                            1 Reply Last reply
                            0
                            • ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #15

                              also don't know if, it is related.

                              but i had this in the configuration:

                              persistence_file: 'mysensors.json'
                              

                              But every time i started the HA, the log said it couldnt find the file. But efter i removed it, and create the new file i couldnt find. the new log have this:

                              16-03-12 22:26:47 homeassistant.bootstrap: Error during setup of component mysensors
                              Traceback (most recent call last):
                                File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 105, in _setup_component
                                  if not component.setup(hass, config):
                                File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 111, in setup
                                  port, persistence, persistence_file, version, baud_rate)
                                File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 75, in setup_gateway
                                  baud=baud_rate)
                                File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 277, in __init__
                                  persistence_file, protocol_version)
                                File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 32, in __init__
                                  self._load_sensors()
                                File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 162, in _load_sensors
                                  self._perform_file_action(self.persistence_file, 'load')
                                File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 177, in _perform_file_action
                                  func(filename)
                                File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 133, in _load_pickle
                                  self.sensors = pickle.load(file_handle)
                              EOFError: Ran out of input
                              
                              1 Reply Last reply
                              0
                              • ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #16

                                the new config looks like this

                                mysensors:
                                  gateways:
                                    - port: '/dev/ttyUSB0'
                                      baud_rate: 38400
                                  debug: true
                                  persistence: true
                                  version: '1.5'
                                  optimistic: true
                                
                                1 Reply Last reply
                                0
                                • martinhjelmareM Offline
                                  martinhjelmareM Offline
                                  martinhjelmare
                                  Plugin Developer
                                  wrote on last edited by
                                  #17

                                  Which arduino model are you using for the gateway?

                                  1 Reply Last reply
                                  0
                                  • ? Offline
                                    ? Offline
                                    A Former User
                                    wrote on last edited by
                                    #18

                                    Its a nano.

                                    1 Reply Last reply
                                    0
                                    • martinhjelmareM Offline
                                      martinhjelmareM Offline
                                      martinhjelmare
                                      Plugin Developer
                                      wrote on last edited by martinhjelmare
                                      #19

                                      Did you change baudrate in MyConfig.h to 38400? Otherwise I think we've found the problem.

                                      Nano can use the default 115200 baudrate in MyConfig.h. The baudrate in HA config has to match. You can remove that line and hass will default to 115200.

                                      1 Reply Last reply
                                      0
                                      • ? Offline
                                        ? Offline
                                        A Former User
                                        wrote on last edited by
                                        #20

                                        no i haven't, so i have just removed the line, and restarted HA.
                                        But no luck. im still getting this.

                                        Traceback (most recent call last):
                                          File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 105, in _setup_component
                                            if not component.setup(hass, config):
                                          File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 111, in setup
                                            port, persistence, persistence_file, version, baud_rate)
                                          File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 75, in setup_gateway
                                            baud=baud_rate)
                                          File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 277, in __init__
                                            persistence_file, protocol_version)
                                          File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 32, in __init__
                                            self._load_sensors()
                                          File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 162, in _load_sensors
                                            self._perform_file_action(self.persistence_file, 'load')
                                          File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 177, in _perform_file_action
                                            func(filename)
                                          File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 133, in _load_pickle
                                            self.sensors = pickle.load(file_handle)
                                        EOFError: Ran out of input
                                        
                                        1 Reply Last reply
                                        0
                                        • ? Offline
                                          ? Offline
                                          A Former User
                                          wrote on last edited by
                                          #21

                                          okay putting

                                          persistence_file: 'mysensors.json'
                                          

                                          Will get the gateway started. but will result in a file not found. if i put the correct path in like

                                          persistence_file: '/var/opt/homeassistant/mysensors.json'
                                          

                                          i get this in the log.

                                          16-03-13 02:11:26 homeassistant.bootstrap: Error during setup of component mysensors
                                          Traceback (most recent call last):
                                            File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 105, in _setup_component
                                              if not component.setup(hass, config):
                                            File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 111, in setup
                                              port, persistence, persistence_file, version, baud_rate)
                                            File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 75, in setup_gateway
                                              baud=baud_rate)
                                            File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 277, in __init__
                                              persistence_file, protocol_version)
                                            File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 32, in __init__
                                              self._load_sensors()
                                            File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 162, in _load_sensors
                                              self._perform_file_action(self.persistence_file, 'load')
                                            File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 177, in _perform_file_action
                                              func(filename)
                                            File "/var/opt/homeassistant/lib/mysensors/mysensors.py", line 145, in _load_json
                                              self.sensors = json.load(file_handle, cls=MySensorsJSONDecoder)
                                            File "/usr/lib/python3.4/json/__init__.py", line 268, in load
                                              parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
                                            File "/usr/lib/python3.4/json/__init__.py", line 331, in loads
                                              return cls(**kw).decode(s)
                                            File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
                                              obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                                            File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
                                              raise ValueError(errmsg("Expecting value", s, err.value)) from None
                                          ValueError: Expecting value: line 1 column 1 (char 0)
                                          
                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          24

                                          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