james-fry / hassio-addons

Repository for hass.io add ons
99 stars 96 forks source link

Async read stalled, exiting! #29

Open xKronyx opened 4 years ago

xKronyx commented 4 years ago

The addon is running on docker, hassio also on docker on ubuntu 19.04 I have this error since 2 weeks, it was working since about 6 months without any issues, the only thing i can see is the Hassio / home assistant updates. Anyone have a clue ?

Thanks !

clsferguson commented 4 years ago

Yeah I have been getting this lots. It has not worked for me reliably.

clsferguson commented 4 years ago

i'm trying this now.

https://github.com/james-fry/hassio-addons/issues/23#issuecomment-552189765

ericreich commented 4 years ago

I am also seeing this. Also it hangs with nothing in the logs..

clsferguson commented 4 years ago

I think I resolved it for me. it is a problem with the code in the rtl2mqtt.sh file. Just coded for an outdated version of rtl_433. Try this.

remove

/usr/local/bin/rtl_433 -F json -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET | while read line
do
  DEVICE="$(echo $line | jq --raw-output '.model' | tr -s ' ' '_')" # replace ' ' with '_'
  DEVICEID="$(echo $line | jq --raw-output '.id' | tr -s ' ' '_')"

  MQTT_PATH=$MQTT_TOPIC

  if [ ${#DEVICE} > 0 ]; then
    MQTT_PATH=$MQTT_PATH/"$DEVICE"
  fi
  if [ ${#DEVICEID} > 0 ]; then
    MQTT_PATH=$MQTT_PATH/"$DEVICEID"
  fi

  # Create file with touch /tmp/rtl_433.log if logging is needed
  [ -w /tmp/rtl_433.log ] && echo $line >> rtl_433.log
  echo $line | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t $MQTT_PATH
done

replace it with (one line) /usr/local/bin/rtl_433 -M newmodel -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET -F "mqtt://$MQTT_HOST:1883,user=$MQTT_USER,pass=$MQTT_PASS,retain=0,events=$MQTT_TOPIC[/model][/subtype][/id]"

ericreich commented 4 years ago

I am trying this now. Looks like everything loaded successfully. I will see how long it stays running now. Thanks!!

ericreich commented 4 years ago

This is not working for me. This changes the MQTT topic as well as the payload sent to MQTT. I have tried to modify my Node Red automations to the new topic, but does not ever trigger. I do see the messages are getting to the MQTT broker. Also when the add on fails to talk to the dongle, there are no messages. I have had to revert back to the previous lines that were removed.

clsferguson commented 4 years ago

Bummer. Have you tried a ruibuild of the addon?

ericreich commented 4 years ago

Yes, I have tried to rebuild as well. I am going to order another brand dongle to verify that I am not having hardware issues.

Looking at using this part on Amazon... B01GDN1T4S.

Thoughts on a good quality SDR dongle? I am using it on 319.5 Mhz.

clsferguson commented 4 years ago

I am using this one on my pi3 b+ same frequency.

https://www.amazon.ca/dp/B00PAGS0HO/ref=cm_sw_r_other_apa_i_S13gEb9FEERHA

clsferguson commented 4 years ago

The command line I shared above you can modify to try and match your previous mqtt topics.

clsferguson commented 4 years ago

Can you share the mqtt messages you receive and would like to keep receiving?

ericreich commented 4 years ago

Thats the same dongle I am using, just different logo and brand. It's the same shape and color.

Here is what I am expecting.. on topic "homeassistant/sensor/Interlogix/aac6da" { "time": "2020-01-12 14:20:20", "model": "Interlogix", "device_type": "contact", "id": "aac6da", "battery": "OK", "switch1": "OPEN", "switch2": "OPEN", "switch3": "CLOSED", "switch4": "OPEN", "switch5": "OPEN", "raw_message": "8d14a4" }

Here is the topic I was getting with your update.. " homeassistant/sensor/Interlogix-Security/contact/aac6da"

{ "time": "2020-01-12 14:23:08", "model": "Interlogix-Security", "subtype": "contact", "id": "aac6da", "battery_ok": 1, "switch1": "OPEN", "switch2": "OPEN", "switch3": "CLOSED", "switch4": "OPEN", "switch5": "OPEN", "raw_message": "cd15b4" }

I think some of those other lines that I remarked out look to be modifying the model, but I am not that good with coding. I tried to just swap out the driver loading line with yours, but no luck as well...

Thanks for your help!!

clsferguson commented 4 years ago

Use this line.

/usr/local/bin/rtl_433 -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET -F "mqtt://$MQTT_HOST:1883,user=$MQTT_USER,pass=$MQTT_PASS,retain=0,events=$MQTT_TOPIC[/model][/id]"

ericreich commented 4 years ago

With or without those additional lines that you had removed earlier?

clsferguson commented 4 years ago

Without

Those additional lines were the old method rtl_433 used to publish mqtt. The newer versions have a built in mqtt publisher. It eliminates an external call.

Also the -M newmodels flag will be forced one day within the rtl_433 software. Changing all your topics to interlogic-security


From: ericreich notifications@github.com Sent: Sunday, January 12, 2020 1:54:54 PM To: james-fry/hassio-addons hassio-addons@noreply.github.com Cc: clsferguson Corpo_@hotmail.com; Comment comment@noreply.github.com Subject: Re: [james-fry/hassio-addons] Async read stalled, exiting! (#29)

With or without those additional lines that you had removed earlier?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/james-fry/hassio-addons/issues/29?email_source=notifications&email_token=ALU4VKLAUC3UEO4WKTRDCULQ5N7R5A5CNFSM4J3LYOD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIXD6WY#issuecomment-573456219, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALU4VKON4OAM7R5CRSIXAXTQ5N7R5ANCNFSM4J3LYODQ.

ericreich commented 4 years ago

I do not see the -M in your new line...

So I am getting the correct topic "homeassistant/sensor/Interlogix/aac6da" and payload of.. { "time": "2020-01-12 15:14:37", "model": "Interlogix", "device_type": "contact", "id": "aac6da", "battery": "OK", "switch1": "OPEN", "switch2": "OPEN", "switch3": "CLOSED", "switch4": "OPEN", "switch5": "OPEN", "raw_message": "cd15b4" }

But for some reason Node Red is not acting on it. I even tried a complete reboot of Hassio.. Flipped back to original lines, and it works again.

Just an FYI, In node red, I am looking for the payload to contain "switch1": "OPEN" or "switch1": "CLOSED"

clsferguson commented 4 years ago

Yeah I removed the -M flag for your setup.

Weird though that node red doesn't see it.

clsferguson commented 4 years ago

The new method changes the battery field still while using old models. Maybe that's why?

ericreich commented 4 years ago

I'm not doing anything with that battery field..

Even then with the new line you sent, I am getting the exact same MQTT message and topic now. It should trigger without making any changes to node red.

Got me... I guess I will try a new dongle to see if it stays up and running longer than just a few hours.

clsferguson commented 4 years ago

Copy that man. Good luck.

clsferguson commented 4 years ago

I actually have the exact same setup. I made binary mqtt sensors in home assistant though to watch for those payloads.

ericreich commented 4 years ago

I can try that. Could you send me how you configured your sensors in your yaml file?

On Jan 12, 2020, at 3:45 PM, clsferguson notifications@github.com wrote:

I actually have the exact same setup. I made binary mqtt sensors in home assistant though to watch for those payloads.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/james-fry/hassio-addons/issues/29?email_source=notifications&email_token=AOIBYP7NHJCSXYFJQ66CL53Q5OFP5A5CNFSM4J3LYOD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIXFCSY#issuecomment-573460811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOIBYP5LPVUPIHSENZUJNYLQ5OFP5ANCNFSM4J3LYODQ.

clsferguson commented 4 years ago
binary_sensor:
  - platform: mqtt
    device_class: door
    name: "Dining room door 433"
    state_topic: "RTL/sensor/Interlogix-Security/contact/adad73"
    qos: 0
    payload_on: "OPEN"
    payload_off: "CLOSED"
    value_template: '{{ value_json.switch1 }}'

  - platform: mqtt
    device_class: window
    name: "Kylee's bedroom window 433"
    state_topic: "RTL/sensor/Interlogix-Security/contact/a7974b"
    qos: 0
    payload_on: "OPEN"
    payload_off: "CLOSED"
    value_template: '{{ value_json.switch1 }}'
ericreich commented 4 years ago

That works. I am using the 1st method with the -M.

Also had to use the new topic to create the sensor like you have. Seams to work like a champ. We will see now if it stays stable for more than a few hours.

Thanks again for your help.

On Jan 12, 2020, at 4:17 PM, clsferguson notifications@github.com wrote:

binary_sensor:

clsferguson commented 4 years ago

Cool let me know. I'm curious.

clsferguson commented 4 years ago

is it working?

ericreich commented 4 years ago

I just got it replaced a few minutes ago. We will see how it acts now.

On Jan 16, 2020, at 1:47 AM, clsferguson notifications@github.com wrote:

is it working?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/james-fry/hassio-addons/issues/29?email_source=notifications&email_token=AOIBYPZGAWG5WQ2N5DAJJQLQ6AGINA5CNFSM4J3LYOD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJDDKCA#issuecomment-575026440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOIBYP4WTLSYSVZPUMYNJWLQ6AGINANCNFSM4J3LYODQ.

xKronyx commented 4 years ago

replacing with this line did the trick !

/usr/local/bin/rtl_433 -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET -F "mqtt://$MQTT_HOST:1883,user=$MQTT_USER,pass=$MQTT_PASS,retain=0,events=$MQTT_TOPIC[/model][/id]"

And comented the old one

/usr/local/bin/rtl_433 -M newmodel -F json -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET | while read line

Thanks !