Synology DSM Integration Requests

Hello,

I have enabled the Synology DSM integration and it’s working great!

But I have a couple requests.

#1 Can we change the “Network UP” and “Network Down” sensors to display in mbps instead of the current kbps? Or…can the sensor automatically adapt and display the units based on the amount of traffic? For example, if there’s no traffic, it’s perfectly fine to display the idle speed at kb/s, However, if there’s a file transfer the sensor would automatically change to mbps as needed.

#2 Can we add the ability to change the update intervals? I would like the sensors to update every 10 or 15 seconds instead of its current setting (guessing it’s currently 30 or 60 seconds).

Thanks!
Mike

Regarding point one, you can do this with a template sensor. For example:

value_template: >
  {% if states('sensor.network_up') > 1024 -%}
    {{ state('sensor.network_up') / 1024 }}
  {%- else -%}
    {{ states('sensor.network_up') }}
  {%- endif %}

Hi @ZephireNZ

I like your idea, but having trouble implementing it.

Here’s what I have…and it’s not displaying anything at all.

sensor 8:
  - platform: template
    sensors:
      synology_down:
        value_template: >
          {% if states('sensor.synology_network_down') > 1024 -%}
            {{ state('sensor.synology_network_down') / 1024 }}
          {%- else -%}
            {{ states('sensor.synology_network_down') }}
          {%- endif %}

Do I have the everything correct?

Oops, I had a typo on the second line of the template - should be states instead of state. You might also need to coerce the sensor state with states('blah')|float / 1024 so that it calculates correctly.

I would recommend testing it in Developer Tools > Templates, you can paste the code in and tweak until it displays what you want.

Update interval can be change in integration options

OK. So I have it “almost” figured out!! Now I am having trouble with too many numbers after the decimal.

Heres’ my code:

sensor 8:
  - platform: template
    sensors:
      synology1_down:
        value_template: >
          {% if states('sensor.synology_network_down') | float > 1024 -%}
            {{ states('sensor.synology_network_down') | float / 1024 | round(1) }} MB/s
          {%- else -%}
            {{ states('sensor.synology_network_down') | round(1) }} Kb/s
          {%- endif %}

An example of the output is: 139.48046875 MB/s

How can I alter the code to have the output be: 139.5 MB/s

I have figured it out. I needed to add some additional parenthesis to get the round(1) function to work properly.

Here’s the working code.


sensor 8:
  - platform: template
    sensors:
      synology1_down:
        value_template: >
          {% if states('sensor.synology_network_down') | float > 1024 -%}
            {{ (states('sensor.synology_network_down') | float / 1024) | round(1) }} MB/s
          {%- else -%}
            {{ states('sensor.synology_network_down') | round(1) }} kB/s
          {%- endif %}

Now, I’d still like to figure out how to change the refresh rate to 15 seconds. The “Update Interval” in the integration options has to be a whole number (i.e. 0,1,2). By default, it is 1 minute. The only lower option is 0 which is constant and puts a strain on the NAS CPU.

I’d like to be able to change this to 15 or 30 seconds if possible.