rpi+mqtt+hass: persistence_file - file does not exist or is not readable



  • Hey guys,

    I have tried a lot but I am running out of ideas:

    Mar 28 23:48:02 raspberrypi hass[4183]: #033[0m
    Mar 28 23:48:02 raspberrypi hass[4183]: #033[32m17-03-28 23:48:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=introduction>#033[0m
    Mar 28 23:48:02 raspberrypi hass[4183]: #033[32m17-03-28 23:48:02 INFO (MainThread) [homeassistant.bootstrap] Setting up recorder#033[0m
    Mar 28 23:48:02 raspberrypi hass[4183]: #033[32m17-03-28 23:48:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=recorder>#033[0m
    Mar 28 23:48:02 raspberrypi hass[4183]: #033[32m17-03-28 23:48:02 INFO (MainThread) [homeassistant.bootstrap] Setting up logger#033[0m
    Mar 28 23:48:02 raspberrypi hass[4183]: #033[33m17-03-28 23:48:02 WARNING (Thread-5) [homeassistant.components.emulated_hue] Listen IP address not specified, auto-detected address is 192.168.1.9#033[0m
    Mar 28 23:48:07 raspberrypi hass[4183]: #033[33m17-03-28 23:48:07 WARNING (Thread-1) [mysensors.mysensors] File does not exist or is not readable: /home/homeassistant/.homeassistant/mysensors.json#033[0m
    Mar 28 23:48:07 raspberrypi hass[4183]: #033[33m17-03-28 23:48:07 WARNING (Thread-1) [mysensors.mysensors] Trying backup file: /home/homeassistant/.homeassistant/mysensors.json.bak#033[0m
    Mar 28 23:48:07 raspberrypi hass[4183]: #033[33m17-03-28 23:48:07 WARNING (Thread-1) [mysensors.mysensors] File does not exist or is not readable: /home/homeassistant/.homeassistant/mysensors.json.bak#033[0m
    Mar 28 23:48:07 raspberrypi hass[4183]: #033[33m17-03-28 23:48:07 WARNING (Thread-1) [mysensors.mysensors] Failed to load sensors from file: /home/homeassistant/.homeassistant/mysensors.json#033[0m
    Mar 28 23:48:18 raspberrypi hass[4183]: #033[32m17-03-28 23:48:18 INFO (Thread-14) [mysensors.mysensors] Setting up initial MQTT topic subscription#033[0m
    Mar 28 23:48:18 raspberrypi hass[4183]: #033[36m17-03-28 23:48:18 DEBUG (Thread-14) [mysensors.mysensors] Subscribing to: P/+/+/0/+/+#033[0m
    Mar 28 23:48:18 raspberrypi hass[4183]: #033[36m17-03-28 23:48:18 DEBUG (Thread-14) [mysensors.mysensors] Subscribing to: P/+/+/3/+/+#033[0m
    
    415 mysensors:
    416   gateways:
    417     - device: mqtt
    418       persistence_file: '/home/homeassistant/.homeassistant/mysensors.json'
    419 #      persistence_file: '/home/pi/mysensors.json'
    420 #      persistence_file: '/tmp/mysensors-moist.json'
    421       #topic_in_prefix: 'mygateway1-out'
    422       topic_in_prefix: 'P'
    423       #topic_out_prefix: 'mygateway1-in'
    424       topic_out_prefix: 'S'
    425   debug: true
    426   optimistic: false
    427   persistence: true
    428   retain: true
    429   version: 2.0
    

    Anybody knows why I cant create the persistance file?


  • Plugin Developer

    @monkee

    Hi!

    The persistence file will be created automatically when the first updates come in from your sensor(s). The first time you start home assistant with mysensors activated, this log warning is expected.



  • @martinhjelmare
    Thank you for your reply.
    I am using the moisture sensor. https://www.mysensors.org/build/moisture
    I just copied the sketch. As far as I understand it, there are no changes necessary.

    This is some output from the Arduino Seriel Monitor:

    112455 TSM:ID:REQ
    112458 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    114465 !TSM:ID:FAIL
    114466 TSM:FAIL:CNT=6
    114468 TSM:FAIL:PDT
    124471 TSM:FAIL:RE-INIT
    124473 TSM:INIT
    124480 TSM:INIT:TSP OK
    124482 TSM:FPAR
    124485 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    124566 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    124571 TSF:MSG:FPAR OK,ID=0,D=1
    126493 TSM:FPAR:OK
    126494 TSM:ID
    126496 TSM:ID:REQ
    126499 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    128506 TSM:ID
    128507 TSM:ID:REQ
    128510 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    130518 TSM:ID
    130519 TSM:ID:REQ
    130522 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    132529 TSM:ID
    132530 TSM:ID:REQ
    132533 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    134540 !TSM:ID:FAIL
    134541 TSM:FAIL:CNT=7
    134544 TSM:FAIL:PDT
    194546 TSM:FAIL:RE-INIT
    194548 TSM:INIT
    194555 TSM:INIT:TSP OK
    194557 TSM:FPAR
    194561 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    194913 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    194918 TSF:MSG:FPAR OK,ID=0,D=1
    196569 TSM:FPAR:OK
    196570 TSM:ID
    196572 TSM:ID:REQ
    196575 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    198582 TSM:ID
    198583 TSM:ID:REQ
    198586 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    200593 TSM:ID
    200594 TSM:ID:REQ
    200597 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    202604 TSM:ID
    202605 TSM:ID:REQ
    202608 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    204615 !TSM:ID:FAIL
    204616 TSM:FAIL:CNT=7
    204618 TSM:FAIL:PDT
    

    This is some output from the mysgw.service
    ( tail -n 40 -F /var/log/syslog | grep mysgw)

    Mar 29 17:36:52 raspberrypi mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    Mar 29 17:36:52 raspberrypi mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    Mar 29 17:37:56 raspberrypi mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Mar 29 17:37:56 raspberrypi mysgw: TSF:MSG:BC
    Mar 29 17:37:56 raspberrypi mysgw: TSF:MSG:FPAR REQ,ID=255
    Mar 29 17:37:56 raspberrypi mysgw: TSF:PNG:SEND,TO=0
    Mar 29 17:37:56 raspberrypi mysgw: TSF:CKU:OK
    Mar 29 17:37:56 raspberrypi mysgw: TSF:MSG:GWL OK
    Mar 29 17:37:56 raspberrypi mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Mar 29 17:37:58 raspberrypi mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    Mar 29 17:37:58 raspberrypi mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    Mar 29 17:38:02 raspberrypi mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    Mar 29 17:38:02 raspberrypi mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    Mar 29 17:39:06 raspberrypi mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Mar 29 17:39:06 raspberrypi mysgw: TSF:MSG:BC
    Mar 29 17:39:06 raspberrypi mysgw: TSF:MSG:FPAR REQ,ID=255
    Mar 29 17:39:06 raspberrypi mysgw: TSF:PNG:SEND,TO=0
    Mar 29 17:39:06 raspberrypi mysgw: TSF:CKU:OK
    Mar 29 17:39:06 raspberrypi mysgw: TSF:MSG:GWL OK
    Mar 29 17:39:07 raspberrypi mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Mar 29 17:39:08 raspberrypi mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    Mar 29 17:39:08 raspberrypi mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    Mar 29 17:39:10 raspberrypi mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    Mar 29 17:39:10 raspberrypi mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    Mar 29 17:39:12 raspberrypi mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    Mar 29 17:39:12 raspberrypi mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    Mar 29 17:39:14 raspberrypi mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    Mar 29 17:39:14 raspberrypi mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    

    Can you help me understand those logs? As far as I interpret it, the moisture sensor runs (but gets no ID from time to time?!) (346778 !TSM:ID:FAIL)....
    Does my moisture sensor send updates? Does it work?

    Thank you!


  • Mod

    @monkee If no ID set it can not work. Try running the clear eeprom sketch and reload your sketch and set ID 2 or 3


  • Plugin Developer

    @monkee

    If you have the controller connected, ie home assistant, it should answer the request for ID. That doesn't seem to happen.



  • @gohan Did as you suggested (cleared the rom) and changed the line from "#define CHILD_ID 0" to "#define CHILD_ID 3". Now I get:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    6 TSF:WUR:MS=0
    13 TSM:INIT:TSP OK
    15 !TSF:SID:FAIL,ID=0
    17 TSM:FAIL:CNT=1
    18 TSM:FAIL:PDT
    10021 TSM:FAIL:RE-INIT
    10023 TSM:INIT
    10031 TSM:INIT:TSP OK
    10033 !TSF:SID:FAIL,ID=0
    10035 TSM:FAIL:CNT=2
    10037 TSM:FAIL:PDT
    20040 TSM:FAIL:RE-INIT
    20042 TSM:INIT
    20049 TSM:INIT:TSP OK
    20051 !TSF:SID:FAIL,ID=0
    20054 TSM:FAIL:CNT=3
    20056 TSM:FAIL:PDT
    30059 TSM:FAIL:RE-INIT
    30061 TSM:INIT
    30068 TSM:INIT:TSP OK
    30070 !TSF:SID:FAIL,ID=0
    30072 TSM:FAIL:CNT=4
    

    @martinhjelmare
    I have the controller connected? Means I have started home-assistant on a rpi (connected with the sensor network i hope, as explained here https://www.mysensors.org/build/raspberry ) What could be wrong?


  • Mod

    @monkee
    it still tries to assign ID 0. Don't you have another arduino to try just to be safe?


  • Plugin Developer

    @monkee

    Child id is not the same as node id. Use MY_NODE_ID if you want to set a static node id in the sketch.


  • Plugin Developer

    @monkee

    I see a problem. Your topic prefix reported in the gateway log is not the same as the prefixes you have set in the home assistant config for mysensors.


  • Mod

    @martinhjelmare said in rpi+mqtt+hass: persistence_file - file does not exist or is not readable:

    @monkee

    Child id is not the same as node id. Use MY_NODE_ID if you want to set a static node id in the sketch.

    woops, I missed that. I answered while at work and I was in a hurry 😄



  • @gohan
    New Arduino wired and conncted, uploaded sketch, etc.
    Same result.

    @martinhjelmare
    I changed the hass cfg to:

    417 mysensors:
    418   gateways:
    419     - device: mqtt
    420       persistence_file: '/home/homeassistant/.homeassistant/mysensors.json'
    421       topic_in_prefix: 'mysensors-out'
    422       topic_out_prefix: 'mysensors-in'
    

    Now its the same as reported in the gateway log...

    Its working. Thanks guys!

    One last question, just to be clear:
    Its fine to have "#define CHILD_ID 0", right?


  • Mod

    that is used later in the presentation


Log in to reply
 

281
Online

6.7k
Users

7.6k
Topics

80.4k
Posts

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.