catchdave / home-assistant-synology-dsm

Custom version of synology DSM that adds HyperBackup tasks
MIT License
5 stars 0 forks source link

devices becoming unavailable, home assistant restart required to get them back #5

Open prankousky opened 6 months ago

prankousky commented 6 months ago

Hi everybody,

I recently stumbled upon this project and needed it to monitor whether or not hyper backup tasks were running. I have one DS918+ and one DS413 connected.

The workflow is

So in the morning, none of the sensors provided by this integration work, because both devices are powered off. Understandable.

But then, each device ought to be available when turned on, but they are not. Currently, both DS are on. The DS918 (which I started first) does not report anything. Not temperature, not backup tasks (not even the power off button). The sensors because unavailable 13 hours ago, which is when the DS918 was powered off.

However, the DS413, which I started after the DS918 does work. I see the temperature, I have the power off button.

It doesn't matter whether or not I manually restart the integration. If one of the devices (or both) is/are unavailable, they will stay unavailable until I restart Home Assistant.

So current statue: DS918 unavailable, DS413 available. If I were to restart Home Assistant right now, both would be available. But as soon as they'd become unavailable, there would be no other way to get them back but to restart the entire Home Assistant server.

Previously, I used the default Synology integration (that did not provide insight about backup tasks) with the DS918 only. The DS413 was handled by the DS' internal power management. And, as far as I can remember, the DS918 was always available. Now that I have this integration and both DS integrated, one of them often becomes unavailable. But I cannot determine what causes this, and why that particular one. Yesterday, the DS918 was available all day and the DS413 suddenly became unavailable -- today it's the other way around.

The DS413 needs the DS918's backup in progress sensors in order to determine (via Home Assistant automation) when it can shut down. Yeah, it will shut down at 17:00 anyway via internal energy settings, but I would like to disable that and have Home Assistant handle shutdown (and power on via WOL) exclusively.

Is there anything I need to configure on the synology devices? Or some way to find out why this is happening all together? I wasn't able to find anything related in the logs.

Thanks in advance for your help :)

IIIdefconIII commented 6 months ago

somehting like this?

image

IIIdefconIII commented 6 months ago

image

prankousky commented 6 months ago

Yes. Exactly that. This is what the integration provides. But often these sensors all become unavailable and I have to restart Home Assistant to get them back.

IIIdefconIII commented 6 months ago

Perhaps we need to make an automation to restart ha not sure if that works because I believe sometimes I even have to completely restart the Nas.

IIIdefconIII commented 6 months ago

Plus I don't believe we need custom firewall rules or authorizarion or authentication to get this working flawless

IIIdefconIII commented 6 months ago

I have the same issue. Sometime I need to restart my Synology aswell. Joke once in a day or 2,3 I run ha in a vm head we need to escalate this to the devs or soort team of the official intrrgration. I do run Glances aswell which is the most right column in the screenshot I shared

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: prankousky @.> Sent: Monday, May 6, 2024 2:33:09 PM To: catchdave/home-assistant-synology-dsm @.> Cc: Thomas van Dalen @.>; Comment @.> Subject: Re: [catchdave/home-assistant-synology-dsm] devices becoming unavailable, home assistant restart required to get them back (Issue #5)

Yes. Exactly that. This is what the integration provides. But often these sensors all become unavailable and I have to restart Home Assistant to get them back.

— Reply to this email directly, view it on GitHubhttps://github.com/catchdave/home-assistant-synology-dsm/issues/5#issuecomment-2095914179, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACLVJW4VUMWHJBGVQDCZWA3ZA52ALAVCNFSM6AAAAABHIMICJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJVHEYTIMJXHE. You are receiving this because you commented.Message ID: @.***>

prankousky commented 6 months ago

While it's possible to automate restarting Home Assistant, there is no way that this would be practicable. While Home Assistant restarts, timers, automations, and all entities controlled by Home Assistant will be unavailable. This happens multiple times a day. We cannot restart Home Assistant that often.

Same goes for restarting the NAS.

For now, I switched to synology handling startup and shutdown and timed it so that all backups will be done by the time it needs to shut down. But that isn't a great solution, either.

I agree, this does not seem to be related to firewall, as the sensor all do work. Just not at all times.

IIIdefconIII commented 6 months ago

Exactly my backup sensor does work great and my backups runs daily at night and so far that keeps working including smb backup of homeassistant itself I'm also almost yelling my hair out in this but it's working so we stil might to escalate this to the right department

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: prankousky @.> Sent: Monday, May 6, 2024 2:58:12 PM To: catchdave/home-assistant-synology-dsm @.> Cc: Thomas van Dalen @.>; Comment @.> Subject: Re: [catchdave/home-assistant-synology-dsm] devices becoming unavailable, home assistant restart required to get them back (Issue #5)

While it's possible to automate restarting Home Assistant, there is no way that this would be practicable. While Home Assistant restarts, timers, automations, and all entities controlled by Home Assistant will be unavailable. This happens multiple times a day. We cannot restart Home Assistant that often.

Same goes for restarting the NAS.

For now, I switched to synology handling startup and shutdown and timed it so that all backups will be done by the time it needs to shut down. But that isn't a great solution, either.

I agree, this does not seem to be related to firewall, as the sensor all do work. Just not at all times.

— Reply to this email directly, view it on GitHubhttps://github.com/catchdave/home-assistant-synology-dsm/issues/5#issuecomment-2095960353, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACLVJWZIFMRKYM3XGZYMC2DZA546JAVCNFSM6AAAAABHIMICJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJVHE3DAMZVGM. You are receiving this because you commented.Message ID: @.***>

IIIdefconIII commented 6 months ago

image @prankousky I can/should are/is crying now. like i siad before, the right colum is still valid because its from another docker intergration. might be able to change all those stuff on the left with Glances

IIIdefconIII commented 6 months ago

I menan... Glances doet take a big load on specs:

image

prankousky commented 6 months ago

I deleted the entire Synology integration. I had my DSs set up before installing this integration, so perhaps there was an error when switching.

When I then WOL the 413, all sensors were available as soon as it booted up. Great! Then I WOL the 918. Nothing!! Sensors not available.

Then I restarted Home Assistant. The 413 is shut down at the moment. I only booted it up to test whether its sensors would become available.

After this restart, the 413 is unavailable -- which was expected, because it is not running at the moment. However, now the DS918 is available.

I changed nothing about the DS918. It was running; not available in Home Assistant. I restarted Home Assistant, so just two minutes after not a single DS918 sensor being available (before restart), everything works again (after restart).

This cannot be related to the DS. I would understand if the DS had to be restarted if it was causing the error. But (at least for me) it is enough to restart Home Assistant, but not the DS918. So there must be something wrong with the integration.

Perhaps it drops connection and does not attempt to re-connect. Unfortunately, I don't have sufficient knowledge in programming, so I can neither verify, nor repair this.

prankousky commented 6 months ago

I wrote automations and created helpers for


DS918

DS413


The DS413 will also automatically power on and off via the synology energy manager. Since this integrations seems to be unreliable at the moment, I power it on and off this way so that backups can still be processed.

However, if I were to change the backup schedule on my DS918 (for example, start backups one hour earlier than at the moment), this will not adapt to the DS413. It would work with the automations above, because the template entity for next scheduled backup will trigger an automation that updates the input_datetime for powering on the DS413; this would actually still work because it wakes it up via WOL. But powering it down will not work if the shutdown button is unavailable (which it is if the integration doesn't work right).

IIIdefconIII commented 6 months ago

Hi man, im going to inspect this most later much deeper because im time limited now backup(s) currently running (via template) (boolean) what kind of backup, smb, hyper, shares, and or VM's?

Reading further i see we have different models but i think that should be fine for this because this is like the basic at least engineer level 2 should think about...

Im soon going to order a UPS which is synology supported to schedule power clean shutdown and start. Alls furhter is already automaded.

IIIdefconIII commented 6 months ago

image had to restart again today. @ developer, what do i need to send as in terms of logs? so we can investigate it?

Puntoboy commented 6 months ago

I installed this yesterday and today the entities are all unavailable. Reloading the integration doesn't work so I assume restarting HA will be needed. Not ideal.

prankousky commented 6 months ago

@Puntoboy have you tried whether restarting HA will work for you? It does for me. But it is really annoying. Yesterday, I forgot the check, so the entities became unavailable and my DS did not shut down over night (which HA would have triggered, but it wasn't able to automate the shutdown button).

If we need to manually restart HA every day, at least I'd prefer to just manually shut down the DS so that HA can run continuously. But perhaps there is a simple fix to this that anybody might be willing to share with us?

Puntoboy commented 6 months ago

I haven't tried restarting HA yet, I don't really like to restart HA all the time, it's bad enough when HACS integrations need an update.

I will do it to confirm though.

I've only just switched to this integration though, as the built-in Synology one worked fine, it just didn't have the Hyper backup status which would be nice.

Puntoboy commented 6 months ago

Restarting HA fixed the issue, for now.

IIIdefconIII commented 6 months ago

Im still finding out and report back once it's happening by either restart the VM or the Nas. First the VM only because the VM is on the same Nas at my side

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Puntoboy @.> Sent: Monday, May 13, 2024 11:57:11 AM To: catchdave/home-assistant-synology-dsm @.> Cc: Thomas van Dalen @.>; Comment @.> Subject: Re: [catchdave/home-assistant-synology-dsm] devices becoming unavailable, home assistant restart required to get them back (Issue #5)

Restarting HA fixed the issue, for now.

— Reply to this email directly, view it on GitHubhttps://github.com/catchdave/home-assistant-synology-dsm/issues/5#issuecomment-2107145830, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACLVJW4BKM4YWZZ4XYZKHN3ZCCE7PAVCNFSM6AAAAABHIMICJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXGE2DKOBTGA. You are receiving this because you commented.Message ID: @.***>

prankousky commented 6 months ago

So while this is not the solution I was hoping for, I am trying a different approach. There is an API for Synology Diskstation. Have any of your tried working with that? It might be worth a workaround.

One could simply make an http api request every x minutes to get all the information this integration here provides. And it must also be possible to power off the DS this way.

I have tried (using insomnia as REST client), but following the instructions, I cannot even get the example code working, unfortunately.

IIIdefconIII commented 6 months ago

I do eanne bste with u guys but my brains are lottery limited because of an accident but I'll kee following this. About the API indeed. The Glances api can grab alot aswell already

prankousky commented 6 months ago

@IIIdefconIII hope it wasn't something too serious and you'll get well soon!

I don't use Glances, but what I meant was this: instead of using this integration (though I would prefer to use it!), Home Assistant could make REST API calls to the Synology every X minutes and thus receive the very same values this way. Let's say we'd make an http call every 5 minutes, then get information about current updates, temperature, etc. through these API calls.

We wouldn't need to restart HA, because these calls will (or should!) just work. There is no integration with complex code that might crash or break. It sends these requests, it gets the data. Even if there was a problem with one request, the next request will likely work and provide the info (just 5 minutes later than, or whatever other interval it has been set to).

IIIdefconIII commented 6 months ago

Ah ik totally understand what you telling but I'm not the guy to try to create something like this xD I'm a international cloud engineer but that's just another sport in it plus I'm still recovering front my coma from last year so I don't really have the energy and time to set my hyperfocus.

IIIdefconIII commented 6 months ago

@IIIdefconIII hope it wasn't something too serious and you'll get well soon!

I don't use Glances, but what I meant was this: instead of using this integration (though I would prefer to use it!), Home Assistant could make REST API calls to the Synology every X minutes and thus receive the very same values this way. Let's say we'd make an http call every 5 minutes, then get information about current updates, temperature, etc. through these API calls.

We wouldn't need to restart HA, because these calls will (or should!) just work. There is no integration with complex code that might crash or break. It sends these requests, it gets the data. Even if there was a problem with one request, the next request will likely work and provide the info (just 5 minutes later than, or whatever other interval it has been set to).

I'll just gonne figure out if glances can replace all sensors because glances doe work very well. But even glances is failing here and there which runs separately in a docker container next to the ha vm.

Ik had a new scan of me brain in the hospital and my head is rejections the bone more and more... they probably have to place the bone with some material. My familie already call me gogo gadget helicopter. But I'll stay positive as long I can be.

IIIdefconIII commented 1 month ago

ane dup reinstalling en re-setup now it working again..

IIIdefconIII commented 1 month ago

close