Nabu Casa warning when your connection is down / disconnected

Hi all

My first post as a new user; moved over from having OpenHab for many many years (and loving HA)!

Problem description: At times my wifi would drop at home, or my ISP will have an outage. In these cases I’m unaware that HA is disconnected from the internet and therefore Nabu Casa and would like to be informed of this.

Suggestion: Add some configurable timer to Nabu Casa / Cloud integration that would detect such disconnects on their backend, then alert (email?) the user. That way you wont be surprised when you get home and something has happened without HA alerting you or doing some automation didn’t happen.

Hi @Tertiush, welcome to the Home Assistant community.

I came here to suggest something similar. I had a power failure at home (due to a faulty light) while I was away for a few days, fortunately I check Home Assistant regularly and noticed it was unavailable and someone was able to get it sorted. A backend check on Nabu Casa would help with both our cases.

Maybe there could be different levels of alerts depending on how long it has been disconnected for? When it has been disconnected for a few minutes it may just be a WiFi issue (like your case) but an hour or longer could indicate a power (like mine).

Exactly that yes. In the meantime I think I’m going to use the android Tasker app to periodically check if a certain dummy socket is open on my PI (through port forwarding). That would at least prove my internet connection is up.

It would be indeed nice to have a first-party solution since there is now a cloud offered by HA, although at the moment I’m really happy with healtchecks.io - just one line in crontab and you get a nice dashboard view of any and all servers :slight_smile:

3 Likes

I might take a look at that. I’m actually using Uptime Robot, which seems to work well enough for what I need (checking if the remote UI is available).

Well it’s what is doing the ping sensor included in ha :wink: It displays automatically if your internet connection is up and average round-trip time if you want too !
Screenshot_20190622_101437

This service (healthchecks.io) turns out to be exactly what I need. It is insanely easy to configure, and can adapt to a wide variety of notifier channels and heartbeat/keepalive methods.

1 Like

I’ve made a notification to warn me when I’m disconnected from Nabu Casa. I don’t know if it would work in your specific case but it works for me.

Here is the code, this was for the iOS 2.0 beta app but you can change the bottom part to whatever notify service.

automation:
  - alias: "System - Notify if Nabu Casa Unavailable"
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: binary_sensor.remote_ui
        to: 'unavailable'
        for:
          seconds: 60 # allow a min to attempt connecting before showing error
    action:
      - service: notify.mobile_app_sean_s_iphone_xs
        data_template:
          title: "Home Assistant Cloud Unavailable"
          message: "You are not connected to Home Assistant Cloud! Troubleshoot now so mobile app works."
          data:
            url: ""
            push:
              sound: "SiriStopFailure_Haptic.caf" # must import System sounds from App Configuration -> Notifications -> Sounds 
              category: "ha_cmds"
              thread-id: "system"
              badge: 0
4 Likes

How’s it work if your house’s Internet uplink is what failed?

1 Like

I haven’t been in that specific situation yet, but my automation catches the errors when you restart HA and can’t make a successful connection to Nabu Casa. That happens to me from time to time and sometimes I don’t notice, so this warns me right away so I can fix the issue (by restarting again usually).

I know it’s not exactly the same problem OP is facing, but saw this thread and thought I’d share.

this is nice, where is this binary_sensor created? can’t find it as integration ?

It doesn’t show up on the Integrations page, just on your States page or Configuration -> Entity Registry page if you’re a Nabu Casa subscriber and have HA >0.90.

It’s a binary_sensor that reports if you’re connected to Nabu Casa (Home Assistant Cloud) Remote UI or not. In this case when it fails to connect to their servers at all, the sensor reports a state of “unavailable” rather than the usual on/off. My automation just notifies me when it hits that state.

i am a subscriber, but currently logged in locally. Ive tried to connect to remote via:

19

which then says:

26

on Remote UI it says:

18

but there’s no such cloud page in the configuration panel on ha 94.3?

I get that error from remote.nabucasa.com when my instance is not connectable, but a restart fixes it every time for me.

The page in your last screenshot should appear as the very first menu item on the Configuration panel. The URL for it is /config/cloud/account.

If you’re not seeing that, my guess is you don’t have cloud: specified in your configuration.yaml? Not sure what else it could be.

I have successfully been using this third party tool, a Google Apps script which will monitor HomeAssistant instance status:

Ditto. I also set this up and has been working like a charm for sometime now. In addition I’m pinging a local wifi device from within HA and linked this to a notification to warm me of any drops.

Sorry to bump this post, but how do you deal with NabuCasa authentication for the remote UI when using Uptime Robot?

I just point Uptime Robot to the https://longstring.ui.nabu.casa URL. I don’t have any authentication set up at all.

Since the HA authentication is form based (rather than via authentication headers), this seems to work for me. If my HA server is down the request to that URL fails with a timeout and Uptime Robot detects it as down.

If you are havinhg issues, it may be that you need to upgrade your HA instance to 2021.1.5 as the Nabu Casa remote access has been updated to block access to insecure versions of HA (and this may give a non-success HTTP code which Uptime Robot may detect as it being down):

1 Like

Thank you. I searched for a nabu casa sensor in dev tools. Didn’t think to look for a remote ui sensor.

My alert:

- id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  alias: 'Remote UI Alert'
  trigger:
    platform: state
    entity_id: binary_sensor.remote_ui
    for: 60
  action:
  - service: notify.telegram_system
    data:
      title: >
        {% if trigger.to_state.state == 'off' %}
          ⚠️ *Remote UI disconnected*
        {% elif trigger.to_state.state == 'on' %}
          ✅ *Remote UI connected*
        {% else %}
          ❓ *Remote UI unknown state*
        {% endif %}
      message: "Nabu Casa Remote UI is {{ trigger.to_state.state }}"

Probably over kill for most, but if you use WiFi backup you don’t need to worry about your Nabu Casa connection being down.