Automating logout/login to Nabucasa?

I’m one of those people whose Nabucasa account regularly goes wonky and then Alexa can’t control my switches and lights. The only way to fix it is to log out of the Nabucasa cloud, wait a couple of seconds, and then log back in. Although a nuisance, I can do this when I’m home. However, at times, I’m away from the house and my housemate tells me that it’s acting up, again, and, although I can log out of the cloud remotely, I can’t log back in remotely.

Is there some kind of integration or plugin which can automatically bounce my login to nabucasa?

trigger:
  - platform: state
    entity_id: binary_sensor.remote_ui
    to: 'off'
    for: 5
action:
  - service: cloud.remote_connect

This will reconnect your remote UI when it detects it has been disconnected for 5 seconds. So when you disconnect it manually from a remote location.

Or you could create a dashboard button for you and your housemate:

First create this script:

script:
  nc_remote_toggle:
    alias: "Toggle Nabu Casa Remote Conenction"
    icon: "mdi:restart"
    sequence:
      - service: cloud.remote_disconnect
      - delay: 3
      - service: cloud.remote_connect

Then add this button card to your dashboard:

type: button
name: Restart NC Remote
icon: mdi:restart
show_name: true
show_icon: true
tap_action:
  action: call-service
  confirmation:
    text: Are you sure you want to restart Nabu Casa Remote?
  service: script.nc_remote_toggle
1 Like

Thanks for this. I just added an automation to toggle cloud remote access when leave home or return, and was looking for a sensor or attribute I could check as a condition in my automation.

Now I know - binary_sensor.remote_ui.

Thanks!