Troubleshooting PSA add-on with Home Assistant Automation

The PSA add-on (discussed in detail on roenning.net) is useful for managing your DS3 and other compatible vehicles. However, one recurring issue with the add-on is its occasional unreliability. Users may experience instances where the add-on stops working, making critical vehicle data unavailable in Home Assistant.

To address this, I’ve implemented an automation in Home Assistant that monitors the add-on status and takes corrective actions whenever it becomes unresponsive. Below, I’ll explain the issue and share the automation configuration that ensures the app stays operational.

The Issue

The PSA add-on sometimes stops reporting data to Home Assistant, leaving key entities in an “unavailable” state. For instance, binary_sensor.ds3_plugged_in or sensor.ds3_battery_level may fail to update. This could disrupt automation or monitoring setups dependent on accurate data without a proactive fix.

The Solution

The following automation detects when the add-on becomes unresponsive and restarts the associated Home Assistant add-on. If necessary, it also stops and restarts the addon to ensure functionality is fully restored.

Automation Configuration

Here’s the YAML configuration for the automation:

alias: Restart DS3 add-on - unavailable
description: ""
triggers:
  - entity_id:
      - binary_sensor.ds3_plugged_in
    to: unavailable
    for:
      hours: 0
      minutes: 7
      seconds: 0
    trigger: state
conditions: []
actions:
  - action: hassio.addon_restart
    metadata: {}
    data:
      addon: b9f12d83_psacc
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - if:
      - condition: state
        entity_id: sensor.ds3_battery_level
        state: unavailable
        for:
          hours: 0
          minutes: 1
          seconds: 0
    then:
      - action: hassio.addon_stop
        metadata: {}
        data:
          addon: b9f12d83_psacc
      - delay:
          hours: 0
          minutes: 1
          seconds: 0
          milliseconds: 0
      - action: hassio.addon_start
        metadata: {}
        data:
          addon: b9f12d83_psacc
  - action: notify.mobile_app_my_phone
    metadata: {}
    data:
      title: Addon restart
      message: Just restarted DS3 add-on
mode: single

How It Works

  1. Trigger: The automation is triggered when binary_sensor.ds3_plugged_in becomes unavailable for 7 minutes.
  2. Restart Add-on: The first action restarts the PSA app addon in Home Assistant.
  3. Check and Retry: After a 10-minute delay, the automation checks if sensor.ds3_battery_level is still unavailable. If so, it stops and restarts the addon.
  4. Notification: A notification is sent to confirm the addon restart.

Benefits

  • Hands-Free Troubleshooting: This automation handles the issue without requiring manual intervention.
  • Minimal Downtime: By restarting the add-on quickly, the app’s downtime is minimized.
  • Proactive Monitoring: The logic ensures that the add-on is fully functional before resuming normal operations.

Conclusion

While the PSA add-on is not without its quirks, combining it with Home Assistant’s powerful automation capabilities can mitigate reliability issues. The automation shared above has been a game-changer for maintaining a seamless connection with my DS3.

Have you experienced similar issues with the PSA add-on or other integrations? Share your solutions or feedback in the comments section of the blog!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.