Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPS power failure #6

Closed
BeardedTinker opened this issue Aug 17, 2020 · 14 comments
Closed

UPS power failure #6

BeardedTinker opened this issue Aug 17, 2020 · 14 comments
Assignees
Labels
Device Everything related to physical devices Enhancement New feature or request

Comments

@BeardedTinker
Copy link
Owner

So far, only one notification arrives on power failure.
Need to add Alert when system is on UPS + notifications with remaining time.

Probably should also try to intercept shutdown and send message too.

@BeardedTinker BeardedTinker self-assigned this Aug 17, 2020
@BeardedTinker BeardedTinker added the Enhancement New feature or request label Aug 17, 2020
@deadly667
Copy link

deadly667 commented Aug 17, 2020

Also you can add automation when you detect power outage (UPS on battery mode) and after power is back online you turn OFF lights. Ikea lights has fun feature that they turn ON when they got power.

Its just happened to me while we were on vacation. Power outage and after all lights in house was ON, of course I didnt think about it and lights was ON for one day till I didnt see it on my mobile phone :/

@BeardedTinker
Copy link
Owner Author

That's great idea! And you are right!
Philips Hue had that problem, but they updated firmware long time ago to fix this issue.

Have to think a bit more about this one, since it's possible for UPS to shutdown Synology NAS and HA then would not know what to do on boot, when power get's back.

@deadly667
Copy link

deadly667 commented Aug 17, 2020

Well yes, I was thinking about it. For that case when UPS shutdowns everything you cannot do much and this is the worst scenario. You can put that on every restart of HA turn off lights but then you need to add boolean sensor for development (intentional restart) to skip that automation but its not easy and you need to remember to set boolean before restart otherwise you will turn off lights at evening and family will be, lets say, unhappy :D.

I didnt cover this worst scenario because I know that I will forget that boolean. Also I set notification for low battery on UPS so I will know that soon it will shutdown everything. If that happens when nobody is at home than I cannot do anything because you cannot start Synology remotely (if Im not wrong).

@deadly667
Copy link

deadly667 commented Aug 17, 2020

To be precise Synology will go into safe mode, it will not shut down itself BUT in safe mode he shutdowns everything (all services) and also unmounts all disks and next expected action is power loss or cold boot according to Synology documentation.

@CCOSTAN
Copy link

CCOSTAN commented Aug 17, 2020

I've done some work on this based on my Powerwall usage. You might find some ideas and code in there.
CCOSTAN/Home-AssistantConfig#779

@BeardedTinker
Copy link
Owner Author

@deadly667 - it would be great if you cold save state between HA restarts. If there is a way, I'm not sure on how to do it.
In theory, I have an idea, but that would be big hack - to publish specific MQTT message and then on each reboot to check for that message state.... Maybe that could work. But since I now use add-on MQTT, I guess that it's not running or could be delayed during HA startup.
Or based on your idea, probably, easiest way would be to have automation on statrup check if it's daylight and if specific light is on (light that is NEVER on during day), to then turn all lights off...

@BeardedTinker
Copy link
Owner Author

@CCOSTAN - that will be a great inspiration and help with DIYBMS project I'm working on and DIY PowerWall. Thanks for pointing me in that way! Although I'll have it set as proof of concept projects since I live in apartment and would break bunch of building codes I guess :)

@BeardedTinker BeardedTinker changed the title UPS power failer UPS power failure Aug 18, 2020
@BeardedTinker
Copy link
Owner Author

I've captured 3 states of UPS so far. Haven't tested if there is "OB CRITICAL" or not when battery is at critical state, but I guess that there is additional state available.

States I got so far:

When all is OK - Battery full and on mains
Ups Status : Online
Ups Status Data : OL

When on batteries:
Ups Status : On Battery Battery Discharging
Ups Status Data : OB DISCHRG

When on mains and battery charging
Ups Status : Online Battery Charging
Ups Status Data : OL CHRG

Now I should catch states OB DISCHRG and temporarily save it in booblean.
It should be checked on startup of HA and if set to true/on - wait 5 minutes and turn lights off (just to give Zigbee network few more minutes to try and sync back).

@BeardedTinker
Copy link
Owner Author

Now we have 3 automation:

  • UPS_power_failer.yaml - this one is triggered when UPS kicks in sets input_boolean to on
  • UPS_battery_full.yaml - it is triggered when battery is full and if input_boolean state is on .
    This is for when power is restored while HA is still running
  • UPS_battery_failed.yaml - every HA restart this one runs, but is only triggered if input_boolean is set to on.
    Turns lights off and notifies.

If I thought of everything, this should handle all events of UPS correctly. Both when power is restored without failure and also when power is restored after UPS shuts down.
Is this it @deadly667 ?

BeardedTinker pushed a commit that referenced this issue Aug 21, 2020
@BeardedTinker
Copy link
Owner Author

Here is how it looks now:
image
and
image

Third case is hard to test as I would need to cut power to UPS until it dies, and since batteries have lost majority of the capacity I think they wouldn't trigger shutdown in time. So, until I replace batteries, that will not be tested.

Left to do is to make Alerts on remaining capacity and that will wait for battery replacement too...

@BeardedTinker
Copy link
Owner Author

Closing this issue for now as I can't test anything until I replace UPS batteries.
Had replace battery alarm (continuous high pitch beep) at 5:50 AM on Sunday - not funny, took about 15 minutes to reset it.

@BeardedTinker
Copy link
Owner Author

Old batteries have been removed and new ones are in.
I will conduct some power failure tests over the weekend.

@stale
Copy link

stale bot commented Oct 27, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the old-issue label Oct 27, 2020
@stale stale bot closed this as completed Oct 28, 2020
@BeardedTinker
Copy link
Owner Author

Due to new unplaned test, I have a bit more stats about UPS now.
Power lost:
image
UPS depleted:
image
And power restored.
image
But HA didn't start properly - have to see what happened there.

@BeardedTinker BeardedTinker added Device Everything related to physical devices and removed old-issue labels Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Device Everything related to physical devices Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants