SSH Integration - Connect your servers to Home Assistant

To answer my own question, it reports unknown when there are No updates available. When there are, it’ll report a number. It would be great if it would report 0 instead of ‘unknown’

I just installed this great integration and came across the same issue (“updates available” sensor showing “unknown” instead of 0). Although I realize we are more than a year later, I share below a workaround I found in case it can still help someone:

Instead of the original syntax

- command: apt-get -s -o Debug::NoLocking=true upgrade |grep -c ^Inst

use this one:

- command: >-
    resp=$(apt-get -s -q -o Debug::NoLocking=true upgrade | grep -c ^Inst);echo $resp

Although both (expectedly) show an identical result in the console, for some reason that I’m not smart enough to figure out, only the second variant (that echoes the result through an intermediate variable) will have a 0-value properly imported as 0.

1 Like