'Bad byte' error
-
Python library files on Ubuntu are usually found in:
/usr/local/lib/pythonX.X/site-packages -
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/ -
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 -
the new config looks like this
mysensors: gateways: - port: '/dev/ttyUSB0' baud_rate: 38400 debug: true persistence: true version: '1.5' optimistic: true -
Which arduino model are you using for the gateway?
-
Its a nano.
-
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.
-
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 -
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) -
If you check the content of
/var/opt/homeassistantWhat does it show?
-
That's where all my configuration is. And there is a mysensors.json file present.
-
Try deleting the json file and have the full path to the json file in the config, as before. Restart hass.
Edit: Also delete any pickle files, if any.
-
full path and no file, gets me
File does not exist or is not readable: /var/opt/homeassistant/mysensors.jsonbut will get me a gateway started.
-
That's fine, I think. If you check the contents of the folder again, you should see a json file again. It creates the file the first time.
-
nope no file
-
Oh yeah, I think it will create it when the first sensor is added.
Do you get the gateway started message now?
-
Yes i have the gateway started, so i should try to start a sensor to see if it will make the json. and be present in the webgui
-
Yes. Make sure you follow the presentation guide in the docs for mysensors on the HA web.
-
thank you so much, that seem to do the trick. the gate way was started and the sensor was add, as soon as it was turned on.
-
:thumbsup:
I'll think about updating the docs at HA web, to explain things a bit more.