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

Envisalink support #2304

Merged
merged 13 commits into from
Jun 19, 2016
Merged

Envisalink support #2304

merged 13 commits into from
Jun 19, 2016

Conversation

Cinntax
Copy link
Contributor

@Cinntax Cinntax commented Jun 15, 2016

Description:
This is a new platform, with several components to control and show the status of any alarm panel driven by the Eyez-on envisalink platform. This includes both DSC and Honeywell panels.

Related issue (if applicable): Enhancement request 409
https://community.home-assistant.io/t/dsc-alarm-integration/409

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

Example entry for configuration.yaml (if applicable):

envisalink:
#optional
  port: 4025
  evl_version: 3
  keepalive_interval: 60
  zonedump_interval: 30

#required
  host: <envisalink IP address>
  panel_type: HONEYWELL or DSC
  user_name: <pass>
  password: <pass>
  code: '4015'

  zones:
    11:
      name: 'Back Door'
      type: 'opening'

    21:
      name: 'First Floor Motion'
      type: 'motion'

  partitions:
    1:
      name: 'Home Alarm'

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.


config = base_config.get(DOMAIN)

if config.get(CONF_EVL_HOST) is None:
Copy link
Member

Choose a reason for hiding this comment

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

Instead of doing all these error checks, you could consider using a voluptuous schema like for example MQTT uses. Naming it CONFIG_SCHEMA will trigger Home Assistant to validate your config before it arrives in setup(hass, config)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, and using vol.Coerce(int) you can also force data to be an integer etc.

@balloob
Copy link
Member

balloob commented Jun 15, 2016

Wow good job 👍 A few minor comments but this looks very good! ⭐⭐⭐⭐⭐

@Cinntax
Copy link
Contributor Author

Cinntax commented Jun 15, 2016

Awesome- thanks! It's been a relatively long time in the making... Also, I'll get those commits squashed/documentation submitted- it was late, and I had to merge the dev branch in a few times during development, so the squash was not exactly trivial. I wanted to get it in front of you at least.

@balloob
Copy link
Member

balloob commented Jun 16, 2016

Looks like you violated some style guide lines. From your CI build: https://travis-ci.org/home-assistant/home-assistant/jobs/137997755#L197-L278

@Cinntax
Copy link
Contributor Author

Cinntax commented Jun 16, 2016

Oh- sorry wasn't quite ready for you to validate again- I'll get these fixed ASAP.

@Cinntax
Copy link
Contributor Author

Cinntax commented Jun 17, 2016

Alright, I'm all set! However I'm struggling quite a bit with getting everything squashed with the pulls I did in the middle- do you have any tricks for dealing with that?

vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASS): cv.string,
vol.Required(CONF_CODE): cv.string,
vol.Optional(CONF_ZONES): dict,
Copy link
Member

Choose a reason for hiding this comment

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

If this is going to be a dictionary mapping integers (zone_num) to a schema, you can use this:

vol.Optional(CONF_ZONES): {vol.Coerce(int): ZONE_SCHEMA},

This will validate all keys as integers and each value against ZONE_SCHEMA.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome- yes i was definitely trying to figure that out. When I couldn't- that's when I put further validation within the sensor/binary_sensor/alarm_panel. I'll take that logic back out since this is now working. It will make those codebases smaller/simpler.

@Cinntax
Copy link
Contributor Author

Cinntax commented Jun 19, 2016

Thanks for your help- these changes have been made. In terms of the squash- I'm actually wondering if pulling these commits into a new branch and re-submitting might be easiest/cleanest...

@balloob
Copy link
Member

balloob commented Jun 19, 2016

Don't worry about the squashing, GitHub has a built in option now to do it when I press merge.

@balloob balloob merged commit cb6f50b into home-assistant:dev Jun 19, 2016
@Cinntax
Copy link
Contributor Author

Cinntax commented Jun 19, 2016

Excellent- good to know. Thanks!

@Cinntax Cinntax deleted the evl3 branch June 21, 2016 03:04
@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.

2 participants