Nekmo / amazon-dash

Hack your Amazon Dash to run what you want.
MIT License
828 stars 67 forks source link

Evaluate to change sniff filters #73

Closed etatus closed 6 years ago

etatus commented 6 years ago

Put an x into all the boxes [ ] relevant to your issue (like this: [x])

What is the purpose of your issue?

Guideline for bug reports

Description

It seems amazon-dash service consumes a relevant share of CPU (around 15% average) in stand by. I think this is too much for a service like this, especially if you are using a Raspberry Pi as a server. In the same Raspberry Pi, other services like lighttpd, plexmediaserver, transmission and home assistant do not consume more than 2% in stand by.

What I Did

I ran 'top' and 'htop' for a while and observed the results (sorted by cpu usage).

Nekmo commented 6 years ago

Hello. Amazon-dash listens to your network traffic. If you have a lot of traffic Amazon-dash consumes more CPU. Also a raspberry pi has few resources.

Duplicated issue: https://github.com/Nekmo/amazon-dash/issues/40

etatus commented 6 years ago

The thing is that there is another project (specifically oriented to Home Assistant), dasshio, that also listents to the network traffic, but CPU usage is less than 1%. Maybe you can have a look to take some ideas to optimize your great tool, the code is quite simple.

Nekmo commented 6 years ago

@etatus dasshio also uses scapy, but It uses more filters on sniff function

https://github.com/danimtb/dasshio/blob/master/dasshio/dasshio.py#L146

Maybe this will improve the performance but could cause issues in certain situations. I am going to investigate this. Thank you.

Nekmo commented 6 years ago

Ok, It works. Thank you.

etatus commented 6 years ago

How can I try the modified version? Is the version 2.0 ready to download? When do you expect to release it?

Nekmo commented 6 years ago

@etatus This change will be released in release 1.2.0. You can try this version using:

pip install git+https://github.com/Nekmo/amazon-dash.git@develop#egg=amazon-dash

http://docs.nekmo.org/amazon-dash/installation.html

Version 1.2.0 will be released in the coming weeks. There are still several months left for release 2.0.

Amazon-dash 2.0 is a major release and has many changes (+20 execution methods and more). It is still in development.