Add Synology SRM support for sensors

Synology SRM intergration should not add only support for device_trakers but also for sensors to be able to obtain data usage for the current month / day etc.

Does the router support SNMP, if so you could use the SNMP sensor to collect the data.

Then use a SNMP Mib Browser to get the correct oid

SRM’s SNMP doesn’t return anything useful at all - basically the only thing that is of any use (and only minor at that) is CPU

I ended up making the integration myself:


… I finished this in Feb … then 2.5 months after was told they had just updated their standards and were no longer going to accept this because it requires the config.yaml.

Does your integration still work? I take it they are not merging your changes?
I saw your amazing Lovelace example on that GitHub issue, can you provide an example for other cards as well? I would love to have it set up the same way as you did :slight_smile:

Is there any news on this topic?

Not really, you can get some sensor data from SNMP sensor (I have the 2600). Enable SNMP in your router then drop this stuff under your sensor: in config

sensor:

# --- Router cpu  ---
- platform: snmp
  name: 'Router 5 Min Cpu Load'
  host: !secret router
  baseoid: .1.3.6.1.4.1.2021.10.1.5.2
  community: 'public'
  version: '2c'
  scan_interval: 200
  value_template: "{{((value | float) / 100) | float }}"
  
  
# --- Router wan ---  
- platform: snmp
  name: 'SRM WAN in'
  host: !secret router
  baseoid: 1.3.6.1.2.1.31.1.1.1.6.4
  community: 'public'
  version: '2c'
  scan_interval: 30
  
- platform: snmp
  name: 'SRM WAN out'
  host: !secret router
  baseoid: 1.3.6.1.2.1.31.1.1.1.10.4
  community: 'public'
  version: '2c'
  scan_interval: 30
  
- platform: derivative
  name: srm_wan_in_der
  source: sensor.srm_wan_in
  unit_time: s
  unit: B
  
- platform: derivative
  name: srm_wan_out_der
  source: sensor.srm_wan_out
  unit_time: s
  unit: B
  
- platform: template
  sensors:
      wan_download:
        value_template:  "{{ [((states('sensor.srm_wan_in_der')|float(none)*8)/1560000)|round(2, default=none),0]|max }}"
        unique_id: wan_download
        unit_of_measurement: 'Mbps'
        friendly_name: Down speed
      wan_upload:
        value_template:  "{{ [((states('sensor.srm_wan_out_der')|float(none)*8)/1560000)|round(2, default=none),0]|max }}"
        unit_of_measurement: 'Mbps'
        unique_id: wan_upload
        friendly_name: Up speed
      srm_wan_download_mib:
        value_template:  "{{ (states('sensor.srm_wan_in')|float/1000000000)|round(2) }}"
        unit_of_measurement: 'GB'
        friendly_name: Total Download
        unique_id: total_download
      srm_wan_upload_mib:
        value_template:  "{{ (states('sensor.srm_wan_out')|float/1000000000)|round(2) }}"
        unit_of_measurement: 'GB'
        friendly_name: Total Upload
        unique_id: total_upload
1 Like

Is it also possible internal LAN traffic? I mean per single Ethernet port?

Maybe? You have to use SNMP explorer to get the baseoid values. Like MIB Browser. There is more on this in this reddit post: https://www.reddit.com/r/homeassistant/comments/njxon2/making_a_bandwidth_monitor_for_synology_rt2600ac/

But maybe if we nudge the devs in this thread here: https://github.com/home-assistant/core/pull/31523 the implementation can be done properly

I see the pull request is closed, should we open a new request for it?

So logic is quite clear and I am able to browse the full MiB tree and see OiD.

Issue is I can’t figure out how to understand which OiD is what…I raised a ticket to synology to see if the have a MiB guide as they have for DSM

Well… you can sort of download a map that makes it easier to find things. I found those OID values by using a guide like this and then doing some MIB browsing once I got to the same section.

There is a link in there in the beginning to download the Synology MIB, yes I know this one is for DSM but a lot of it overlaps with SRM and even the guide mentions that somethings overlap with SRM.

For example if you search that guide for “Port MIB” you should get an OID of .1.3.6.1.4.1.6574.109 you can then use that in the MIB browser to see if you are getting the right data. You can also look up things by the name, so for example you can see that “laLoadInt.2” is the cpu load for 5minutes but its listed that it only is supported on DSM and not SRM. You can then search for that name in MIB Browser and get the right OID. (For this particular example this is actually not true, SRM uses exact same OID for that sensor, they just didn’t list SRM in supported OS column.).

Meanwhile I got a reply from synology

Thank you for contacting Synology technical support.
There is no specific guide for SRM as it is based on DSM and use the same OID when available.

Good will be as SRM will be add as integration not custom… Integration from user i00 should be add. Looks perfect.

Yeah if we can do another one that would be great! I wish more people would care about the SRM

Hi
Are you still using it in the 2023 version of home assistant?
I bought this router second hand and it would be nice to see some information about hin in HA but so far I did not understand how to proceed with this integration and how to set up the sensors.
It would be nice if you can describe steps to endup with 1 functionnal sensor. I guess that after it is kind of similar job for all the others.
Thanks

Hi @FlyingKangaroo .

I use upnp and get upload\download traffic in KiB/s as well as External IP, uptime and WAN status.
I use a template to conver the traffic into Mbps.
https://www.reddit.com/r/homeassistant/comments/njxon2/making_a_bandwidth_monitor_for_synology_rt2600ac/
You can also use the SRM integration as well to get connected devices\device tracker.
Is this enough for what you want?

Hi @Mark_Wright
Thanks for the answer. In fact I did not really find any integration or which one to chose (sorry it is not yet clear in my mind I read a lot of things on this and I got confuse).
So far I have just done this in my YAML configuration

########################## Synology SRM ########################################
device_tracker:
  - platform: synology_srm
    host: !secret syno_srm_host
    port : 8001
    username: !secret syno_srm_user
    password: !secret syno_srm_pwd
#    ssl: true
    
################################################################################

Could you please detail what configuration steps you have done to achieve your configuration?

  • Which integration you used
  • some part of your configuration code

@FlyingKangaroo .
Make sure you enable upnp in your router.

  1. Go to Network Center > Local Network > Network.
  2. Select the local network where your device is located. Click Edit.
  3. At the Advanced tab, tick Enable UPnP and click OK.

It should now appear in home assistant as a discovered device.

Once added you’ll get the sensors I mentioned in previous post.

@Mark_Wright
Thanks for the answer
My UPnP is activated.
In the list of client only my NAS is visible, not my home assistant computer.
Where should it appear as a discovered device?