Hi all, I am in the midst of trying to integrate the Synology SRM into Home Assistant. I have been following along here:
home-assistant:dev
← i00:dev
opened 08:30AM - 06 Feb 20 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Proposed change
<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
The current SRM integration is used for obtaining devices for tracking only ...
This adds sensor support so that additional information can be obtained from the router (that is not contained in SNMP).
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] New feature (which adds functionality to an existing integration)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Example entry for `configuration.yaml`:
<!--
Supplying a configuration snippet, makes it easier for a maintainer to test
your PR. Furthermore, for new integrations, it gives an impression of how
the configuration would look like.
Note: Remove this section if this PR does not have an example entry.
-->
```yaml
# Example configuration.yaml
sensor:
- platform: synology_srm
host: HOSTNAME
password: PASSWORD
#Optional defaults are below:
#name: synology_srm
#port: 8001
#username: admin
#ssl: true
#verify_ssl: false
#monitored_conditions:
# - core.ddns_extip
## OTHER POSSIBLE VALUES FOR MONITORED CONDTIONS:
## - base.encryption
## - base.info
## - core.ddns_extip
## - core.ddns_record
## - core.system_utilization
## - core.network_nsm_device
## - mesh.network_wanstatus
## - mesh.network_wifidevice
## - mesh.system_info
```
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
Information is returned in attributes, the state is the external IP address.
Here is an example of how to use this to implement entities for current WAN traffic:
```yaml
sensor:
- platform: synology_srm
host: SynologyRouter.local
password: !secret SynologyRouter
monitored_conditions:
- core.ddns_extip
- core.system_utilization
- platform: template
sensors:
wan_download:
value_template: "{% set i = namespace() %}{% set i.i = 0 %}{% for item in states.sensor.synology_srm.attributes.core_system_utilization.network if item.device|regex_match('^(usbnet|ppp)', ignorecase=true) %}{% set i.i = i.i + item.rx %}{% endfor %}{{ ((i.i / 1024 / 1024) * 8)|round(2) }}"
friendly_name: Download
unit_of_measurement: Mbit/s
icon_template: 'mdi:download'
wan_upload:
value_template: "{% set i = namespace() %}{% set i.i = 0 %}{% for item in states.sensor.synology_srm.attributes.core_system_utilization.network if item.device|regex_match('^(usbnet|ppp)', ignorecase=true) %}{% set i.i = i.i + item.tx %}{% endfor %}{{ ((i.i / 1024 / 1024) * 8)|round(2) }}"
friendly_name: Upload
unit_of_measurement: Mbit/s
icon_template: 'mdi:upload'
```
Also ... I am not sure how to submit corresponding documentation along with this as it appears to be in another repo.
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/12096
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [x] The code change is tested and works locally.
- [x] Local tests pass. **Your PR cannot be merged unless tests pass**
- [x] There is no commented out code in this PR.
- [x] I have followed the [development checklist][dev-checklist]
- [x] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
**Will do this up on the week end**
- [x] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
**Does not communicates with devices, web services, or third-party tools**
- [x] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [x] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] Untested files have been added to `.coveragerc`.
The integration reached or maintains the following [Integration Quality Scale][quality-scale]:
<!--
The Integration Quality Scale scores an integration on the code quality
and user experience. Each level of the quality scale consists of a list
of requirements. We highly recommend getting your integration scored!
-->
**How do we get this scored? It isn't apparent in [the docs](https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html)**
- [x] No score or internal
- [ ] 🥈 Silver
- [ ] 🥇 Gold
- [ ] 🏆 Platinum
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
I added this to my config.yaml, although replaced the HOSTNAME and PASSWORD with what I use.
sensor:
I then added the python file but yet see an error with the config.
Platform error sensor.synology_srm - No module named ‘homeassistant.components.synology_srm.sensor’
Any ideas? Thanks in advance