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

Consolidate the netgear_lte configuration #22105

Merged

Conversation

amelchio
Copy link
Contributor

@amelchio amelchio commented Mar 16, 2019

Breaking Change:

The netgear_lte configuration has been consolidated under netgear_lte:, check the documentation for more information.

Description:

Notes:

  • Omitting sensors will set up an unspecified set of default sensors.
  • Omitting notify will set up a notify service notify.netgear_lte with no default recipient.
  • Default notify target has been renamed recipient (fixes Use CONF_RECIPIENT for default recipient in config #20670).
  • Sensors no longer support scan_interval.
  • Hostnames no longer have to be repeated, even with multiple modems.

This should hopefully support the next PRs that I am planning:

  1. Add more sensors (not all added by default)
  2. Update sensor state with the dispatcher helper
  3. Maybe add a config entry

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

Example entry for configuration.yaml:

(The following snippets are both needleesly verbose in order to cover more situations)

Before:

netgear_lte:
  - host: !secret router_hostname
    password: !secret router_password
  - host: !secret failover_modem_hostname
    password: !secret failover_modem_password

notify:
  - platform: netgear_lte
    name: sms
    host: !secret router_hostname
    target: !secret admin_phone
  - platform: netgear_lte
    name: failover_sms
    host: !secret failover_modem_hostname
    target: !secret admin_phone

sensor:
  - platform: netgear_lte
    host: !secret router_hostname
    sensors:
      - usage
      - sms
  - platform: netgear_lte
    host: !secret failover_modem_hostname
    sensors:
      - usage
    scan_interval: 1800

Now:

netgear_lte:
  - host: !secret router_hostname
    password: !secret router_password
    notify:
      - name: sms
        recipient: !secret admin_phone
    sensor:
      monitored_conditions:
        - usage
        - sms
  - host: !secret failover_modem_hostname
    password: !secret failover_modem_password
    notify:
      - name: failover_sms
        recipient: !secret admin_phone
    sensor:
      monitored_conditions:
        - usage

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox.
  • There is no commented out code in this PR.

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][ex-requir]).
  • New dependencies are only imported inside functions that use them ([example][ex-import]).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

@amelchio
Copy link
Contributor Author

Documentation updated.

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Just some small comments.

homeassistant/components/netgear_lte/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/netgear_lte/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/netgear_lte/notify.py Outdated Show resolved Hide resolved
homeassistant/components/netgear_lte/sensor.py Outdated Show resolved Hide resolved
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Nice!

@amelchio
Copy link
Contributor Author

Thanks for being so careful, it really improved things 🥳

@MartinHjelmare MartinHjelmare merged commit 2b6e197 into home-assistant:dev Mar 22, 2019
@ghost ghost removed the in progress label Mar 22, 2019
@balloob balloob mentioned this pull request Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use CONF_RECIPIENT for default recipient in config
4 participants