bkbilly / lnxlink

🖥 Effortlessly manage your Linux machine using MQTT.
https://bkbilly.gitbook.io/lnxlink
MIT License
274 stars 29 forks source link

Request: Add detail info to attributes of System Updates sensor #114

Closed jeremysherriff closed 4 months ago

jeremysherriff commented 4 months ago

Describe the solution you'd like

I would like to be able to see detail information of the updates available, for the System Updates sensor. Ideally;

Alternatively, exposing the count of packages as a separate Sensor would be equally useful, with the pagckages as an attribute of that new sensor.

Additional context

For Ubuntu, I see that the System Updates sensor is triggered by apt list --upgradable | wc -l being parsed as largerthan 2. If the output of apt list --upgradable | grep -v 'Listing...' was grabbed instead (eg as variable RAW), and then parsed in different ways:

Binary sensor = echo $RAW | wc -l largerthan 0

True

Attribute: Count of updates = echo $RAW | wc -l

14

Attribute: Packages = echo $RAW | awk -F '/' '{print $1}'

bind9-dnsutils
bind9-host
bind9-libs
cloud-init
containerd.io
docker-buildx-plugin
docker-ce-cli
docker-ce-rootless-extras
docker-ce
docker-compose-plugin
linux-firmware
python3-update-manager
snapd
update-manager-core
bkbilly commented 4 months ago

Showing the packages available as attributes could cause issues because it would constantly change, so Home Assistant will populate it's database with a lot of entries. A workaround would be to create this sensor and have it disabled as a default, so the user will have to enable it manually.

jeremysherriff commented 4 months ago

An additional, disabled-by-default sensor with update count as the state and an attribute with the package names would be perfect.

I was originally going to request that attribute values were made part of the expose bash commands as part of #111 but I think your idea here is better.

The documentation should include a small warning about HA database bloat though, you are right to be concerned about that.

bkbilly commented 4 months ago

I've created this sensor that includes the number of packages and as attributes, includes all available packages that need to be updated. By default this is disabled and I've also mentioned on the Documentation about the issue with the attributes on the Database of Home Assistant.

jeremysherriff commented 4 months ago

These updates look really good, thank you for your efforts on these.