I had a recurrent home_assistant-ble service crash right after a device detection.
The error message was this one :
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: /usr/lib/ruby/2.3.0/net/http/response.rb:380:ininflate': incorrect header check (Zlib::DataError)
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:380:in block in inflate_adapter' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/protocol.rb:411:incall_block'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/protocol.rb:402:in <<' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/protocol.rb:108:inread'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:402:in read' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:291:inblock in read_body_0'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:262:in inflater' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:281:inread_body_0'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:202:in read_body' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:227:inbody'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:164:in reading_body' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:1445:intransport_request'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:1407:in request' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:137:inblock in update_home_assistant'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:853:in start' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:584:instart'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:132:in update_home_assistant' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:92:inblock in detect_new_devices'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:88:in each' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:88:indetect_new_devices'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:66:in block in run' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:64:inloop'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:64:in run' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/bin/home_assistant-ble:22:in<top (required)>'
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/local/bin/home_assistant-ble:22:in load' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/local/bin/home_assistant-ble:22:in <main> Feb 28 22:39:24 hassbian systemd[1]: home_assistant-ble.service: Main process exited, code=exited, status=1/FAILURE Feb 28 22:39:24 hassbian systemd[1]: home_assistant-ble.service: Unit entered failed state. Feb 28 22:39:24 hassbian systemd[1]: home_assistant-ble.service: Failed with result 'exit-code'. Feb 28 22:39:27 hassbian systemd[1]: home_assistant-ble.service: Service hold-off time over, scheduling restart.
I think I found the problem (at least it worked for me) :
open the file : /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb
in the section "def update_home_assistant(ha_conf, state)" locate the line :
_request = Net::HTTP::Post.new(uri)
request.contenttype = 'application/json'
and add in between this line so it should look like :
_request = Net::HTTP::Post.new(uri)
request["accept-encoding"] = "identity"
request.contenttype = 'application/json'
Reboot or restart the service and everything should work perfectly.
Hello,
I had a recurrent home_assistant-ble service crash right after a device detection.
The error message was this one :
Feb 28 22:39:24 hassbian home_assistant-ble[26959]: /usr/lib/ruby/2.3.0/net/http/response.rb:380:in
inflate': incorrect header check (Zlib::DataError) Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:380:inblock in inflate_adapter' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/protocol.rb:411:in
call_block' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/protocol.rb:402:in<<' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/protocol.rb:108:in
read' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:402:inread' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:291:in
block in read_body_0' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:262:ininflater' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:281:in
read_body_0' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:202:inread_body' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:227:in
body' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http/response.rb:164:inreading_body' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:1445:in
transport_request' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:1407:inrequest' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:137:in
block in update_home_assistant' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:853:instart' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/lib/ruby/2.3.0/net/http.rb:584:in
start' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:132:inupdate_home_assistant' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:92:in
block in detect_new_devices' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:88:ineach' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:88:in
detect_new_devices' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:66:inblock in run' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:64:in
loop' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:64:inrun' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/bin/home_assistant-ble:22:in
<top (required)>' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/local/bin/home_assistant-ble:22:inload' Feb 28 22:39:24 hassbian home_assistant-ble[26959]: #011from /usr/local/bin/home_assistant-ble:22:in <main> Feb 28 22:39:24 hassbian systemd[1]: home_assistant-ble.service: Main process exited, code=exited, status=1/FAILURE Feb 28 22:39:24 hassbian systemd[1]: home_assistant-ble.service: Unit entered failed state. Feb 28 22:39:24 hassbian systemd[1]: home_assistant-ble.service: Failed with result 'exit-code'. Feb 28 22:39:27 hassbian systemd[1]: home_assistant-ble.service: Service hold-off time over, scheduling restart.
I think I found the problem (at least it worked for me) : open the file : /var/lib/gems/2.3.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb
in the section "def update_home_assistant(ha_conf, state)" locate the line : _request = Net::HTTP::Post.new(uri) request.contenttype = 'application/json'
and add in between this line so it should look like : _request = Net::HTTP::Post.new(uri) request["accept-encoding"] = "identity" request.contenttype = 'application/json'
Reboot or restart the service and everything should work perfectly.