SynologyDSM integration broken?

Hi,

I’m runnign DSM 6.2.2 update 4 on my Synology.
I integrated “synologydsm” (HomeAssistant 0.104.1) but I get the following issue:

2020-01-27 00:36:20 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/synologydsm/sensor.py", line 235, in state
    return round(attr / 1024.0, 1)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'

How can I investigate ?

Simone

one of the following sensors is erroring out for your synology system.

["network_up", "network_down"]

It may not be available on your system.

Also, it looks like you aren’t up to date based on those errors.

Hi @petro, thank you for checking.

Will review sensors once at home, but I used the documentation sample for my config :wink:
Also whats is not up to date ? I’m on HomeAssistant 0.104.1 and even if it’s not latest should be quite new.

Simone

You are right, removing “network_up” and the error is gone.

Now I can see a couple of sensors created, but all values are zero :S.
And config list 3 of them, not 2:

sensor:
  - platform: synologydsm
    host: !secret synology_addr
    port: 443
    username: !secret synology_login
    password: !secret synology_pwd
    monitored_conditions:
      - cpu_total_load
      - memory_real_usage
      - disk_smart_status
#      - network_up

Before you ask, I’m able to connect using port 443 because it’s natted by the router.

Simone

@petro, can you help digging into the issue ?

Thank you,

Simone

Not sure I can help. Seems like a networking issue.

From my HA server I can login and get the needed info using the following queries:

https://xxxxx/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account=admin&passwd=xxxxx&session=FileStation&format=cookie
https://xxxxx/webapi/entry.cgi?api=SYNO.Core.System.Utilization&version=1&method=get

In the JSON answer I can see “cpu loads”,“eth0/1 usage” and “memory” :slight_smile:

So I don’t think it’s a network error, but more the plugin that is not working as expected.
Can you help dig into the code ? I know very little of python unfortunately.

Simone

@petro, you know the synologydsm code enough to help digging into it ?

Simone

no, sorry.

Seems plugin is currenly broken: https://github.com/ProtoThis/python-synology/issues/8

Simone

Found a possible fix and opened a issue:

SynologyDSM integration doesn’t handle 2-step authentication

Simone