Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added simple process state monitor source. #3

Merged
merged 3 commits into from
Apr 24, 2014
Merged

Added simple process state monitor source. #3

merged 3 commits into from
Apr 24, 2014

Conversation

fingon
Copy link
Contributor

@fingon fingon commented Apr 23, 2014

[process]
xbmc=XBMC.App

=> ps axw's for XBMC.App, and based on it's presence sets process.xbmc to off/on.

@balloob
Copy link
Member

balloob commented Apr 23, 2014

Cool, I like this addition.

I do would like to see a few fixes before I can accept it.
For one this probably would generate warnings when run with pylint and pep8. You can test it by installing those two tools using pip: pip install pylint pep8 and running it on your code. Reasons why I think it will generate a warning:

  • Functions without documentation
  • Variable names shorter than 3 characters
  • _update_process_state has an unused parameter force_reload

Some other comments;
Because you can't be sure what is happening within the statemachine it is better to set the state to STATE_ON or STATE_OFF even it is the same as before. The statemachine will not change anything or fire a state_changed event if it is the same.

And another point, just a matter of style preference I guess, but line 40-50 can be replaced with:
state = STATE_ON if any(s in line for line in lines) else STATE_OFF

Line 54-57 don't seem to do anything

balloob added a commit that referenced this pull request Apr 24, 2014
Added a simple process state monitor
@balloob balloob merged commit b30aeb1 into home-assistant:master Apr 24, 2014
hansmbakker added a commit that referenced this pull request Jun 2, 2015
aa755 referenced this pull request in aa755/home-assistant Dec 11, 2016
removed more unnecessary fields.
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
balloob pushed a commit that referenced this pull request Jul 18, 2019
* ecobee Preset Fix

* Celsius Fix

* Checks Fix

* Check Fix #2

* Check Fix #3
balloob pushed a commit that referenced this pull request Jul 18, 2019
* ecobee Preset Fix

* Celsius Fix

* Checks Fix

* Check Fix #2

* Check Fix #3
alandtse referenced this pull request in alandtse/home-assistant Oct 12, 2019
* ecobee Preset Fix

* Celsius Fix

* Checks Fix

* Check Fix #2

* Check Fix #3
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants