kirichkov / home_assistant-ble Goto Github PK
View Code? Open in Web Editor NEWCompanion application for home-assistant, sending bluetooth low energy detection
Companion application for home-assistant, sending bluetooth low energy detection
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: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: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:in read' 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:in inflater' 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: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:in
body'
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:in
transport_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: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:in start' 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: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: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: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: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: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: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: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.content_type = 'application/json'
and add in between this line so it should look like :
request = Net::HTTP::Post.new(uri)
request["accept-encoding"] = "identity"
request.content_type = 'application/json'
Reboot or restart the service and everything should work perfectly.
while running in terminal, upon discovery of a listed device from the config, home_assistant-ble crashes.
stack trace:
Just discovered D8:84:DF:14:DA:83
/usr/lib/ruby/2.1.0/net/http/response.rb:357:in finish': incorrect header check (Zlib::DataError) from /usr/lib/ruby/2.1.0/net/http/response.rb:357:in
finish'
from /usr/lib/ruby/2.1.0/net/http/response.rb:262:in ensure in inflater' from /usr/lib/ruby/2.1.0/net/http/response.rb:262:in
inflater'
from /usr/lib/ruby/2.1.0/net/http/response.rb:274:in read_body_0' from /usr/lib/ruby/2.1.0/net/http/response.rb:201:in
read_body'
from /usr/lib/ruby/2.1.0/net/http/response.rb:226:in body' from /usr/lib/ruby/2.1.0/net/http/response.rb:163:in
reading_body'
from /usr/lib/ruby/2.1.0/net/http.rb:1414:in block in transport_request' from /usr/lib/ruby/2.1.0/net/http.rb:1405:in
catch'
from /usr/lib/ruby/2.1.0/net/http.rb:1405:in transport_request' from /usr/lib/ruby/2.1.0/net/http.rb:1378:in
request'
from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:129:in block in update_home_assistant' from /usr/lib/ruby/2.1.0/net/http.rb:853:in
start'
from /usr/lib/ruby/2.1.0/net/http.rb:583:in start' from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:128:in
update_home_assistant'
from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:91:in block in detect_new_devices' from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:88:in
each'
from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:88:in detect_new_devices' from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:66:in
block in run'
from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:64:in loop' from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/lib/home_assistant/ble.rb:64:in
run'
from /var/lib/gems/2.1.0/gems/home_assistant-ble-1.3.1/bin/home_assistant-ble:22:in <top (required)>' from /usr/local/bin/home_assistant-ble:23:in
load'
from /usr/local/bin/home_assistant-ble:23:in `
At least with my nut tracker, out of range detection does not seem to work as expected.
Device might not be detected as disappeared even when out of range.
Common instructions (http://unix.stackexchange.com/questions/96106/bluetooth-le-scan-as-non-root) do not seem to work correctly.
We should have a way to run as non-root.
https://github.com/kamaradclimber/home_assistant-ble/blob/master/lib/home_assistant/ble.rb#L49
I see that you override the device's friendly name on purpose. Can you explain to me what's your reasoning behind it? For me that was unexpected when the device's name changed to it's dev_id
.
Hi, I could not figure out how to install all this. I arrive at the line "Run home_assistant-ble [your config file] binary." and I can not figure out where my config file is located. Can you explain it better? thank you.
Not really an issue but a query.
If I were to run this software on multiple Pi's around my house all reporting to the same HA instance would it still work as intended? I'm using this to detect whether my dog is in the house I have a Pi downstairs and upstairs if I run this on both instances I assume it just updates the HA instance whenever it see's the bt tag on the dog collar. What I'm conerned about is when the dog is away from one of the Pi's it will report the dog as disappeared to the HA instance and may override the fact it has in fact now appeared on the other pi.
Either way thank you very much for this software its very useful and I appreciate it!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.