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

SNMP sensor #2244

Merged
merged 2 commits into from
Jun 9, 2016
Merged

SNMP sensor #2244

merged 2 commits into from
Jun 9, 2016

Conversation

fabaff
Copy link
Member

@fabaff fabaff commented Jun 5, 2016

Description:
A simple SNMP sensor.

Related issue (if applicable): fixes #

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#538

Example entry for configuration.yaml (if applicable):

sensor:
  platform: snmp
  name: Load
  host: 192.168.1.1
  community: public
  baseoid: 1.3.6.1.4.1.2021.10.1.3.1

Checklist:

If user exposed functionality or configuration variables are added/changed:

If code communicates with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@rmkraus
Copy link
Contributor

rmkraus commented Jun 6, 2016

Looks fine to me.

:shipit:

vol.Optional(CONF_PORT): vol.Coerce(int),
vol.Optional(CONF_COMMUNITY): vol.Coerce(str),
vol.Required(CONF_BASEOID): vol.Coerce(str),
vol.Optional('unit_of_measurement'): vol.Coerce(str),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can the user pick a unit of measurement ?

Also, we have a constant for that in homeassistant.const.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can the user pick a unit of measurement ?

Because certain nodes inside the tree are delivered without unit of measurement. Others are. Anyway, in a lot of cases it will be necessary to use a template sensor for the conversion in a more human readable form as long that the template support for this sensor is missing.

Also, we have a constant for that in homeassistant.const.

Thanks, was only checking CONF* and not ATTR*.


PLATFORM_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): 'snmp',
vol.Optional(CONF_NAME): vol.Coerce(str),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference, we have cv.string that is slightly better than this.

@balloob
Copy link
Member

balloob commented Jun 9, 2016

Looks good! 🐬

@balloob balloob merged commit 33cb1b3 into home-assistant:dev Jun 9, 2016
@fabaff fabaff deleted the snmp-sensor branch July 2, 2016 09:46
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
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.

3 participants