Skip to content

Added update_interval to maxcube#14143

Merged
syssi merged 3 commits intohome-assistant:devfrom
dingusdk:maxcube
Apr 29, 2018
Merged

Added update_interval to maxcube#14143
syssi merged 3 commits intohome-assistant:devfrom
dingusdk:maxcube

Conversation

@dingusdk
Copy link
Copy Markdown
Contributor

@dingusdk dingusdk commented Apr 28, 2018

Description:

Fixes the "reset to factory issue" with maxcube. (see this forum post:
https://community.home-assistant.io/t/maxcube-loosing-configuration/46663/11)

I have added an "update_interval" configuration parameter. Having a longer update interval fixes the issue

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

Example entry for configuration.yaml (if applicable):

maxcube:
  gateways:
    - host: 192.168.0.20
      update_interval: 300

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

If the code communicates with devices, web services, or third-party tools:

  • 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:

  • Tests have been added to verify that the new code works.

Comment thread homeassistant/components/maxcube.py Outdated
CONFIG_GATEWAY = vol.Schema({
vol.Required(CONF_HOST): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_UPDATE_INTERVAL, default=300): cv.positive_int,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be a cv.time_period and preferably also cv.positive_timedelta.

vol.All(cv.time_period, cv.positive_timedelta)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have changed it to cv.time_period, and convert to total seconds (I did not make the original max cube code, and wanted to make as few changes as possible, and the original code has the update interval in seconds - hard coded to 60 seconds)

Comment thread homeassistant/components/maxcube.py Outdated
NOTIFICATION_TITLE = 'Max!Cube gateway setup'

CONF_GATEWAYS = 'gateways'
CONF_UPDATE_INTERVAL = 'update_interval'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure about this configuration key name. Most platforms use scan_interval for an update/scan interval.

IMO update_interval makes more sense, but scan_interval would be much more consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have changed it to scan_interval to be more consistent

@syssi syssi merged commit aa8bd37 into home-assistant:dev Apr 29, 2018
@balloob balloob mentioned this pull request May 11, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants