Skip to content

Commit

Permalink
Various small updates, bump ver for release
Browse files Browse the repository at this point in the history
- card age now expressed in hours/days if RPi has gone offline and card is still showing
- suppressed count of OS updates when = -1 (#49)
- described the new available update count in top-level README (#49)
- ensure older card age is still colored red
  • Loading branch information
ironsheep committed Mar 2, 2023
1 parent 4e50149 commit 3ffe926
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 25 deletions.
Binary file added DOCs/images/newIndicatorsV2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DOCs/images/patreon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ Place one of these cards for each of your RPi's on your network (and install the
All of the card forms (as seen above) now have a row of RPi health indicators. With these indicators you can tell:

- If the RPi OS has reached [end of support](https://en.wikipedia.org/wiki/Debian_version_history) (no longer getting security updates) so it probably should be updated
- OS package updates are available
- If a new version of the RPi reporter Daemon is avaialble for install
- When the data shown on the card was last updated

<p align="center">
<img src="./DOCs/images/newIndicators.png" width="500">
<img src="./DOCs/images/newIndicatorsV2.png" width="500">
</p>

---

If you like my work and/or this has helped you in some way then feel free to help me out for a couple of :coffee:'s or :pizza: slices!

[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/ironsheep)
> If you like my work and/or this has helped you in some way then feel free to help me out for a couple of :coffee:'s or :pizza: slices! Or you can support my work via Patreon!
>
> [![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/ironsheep) &nbsp;&nbsp; -OR- &nbsp;&nbsp; [![Patreon](./Docs/images/patreon.png)](https://www.patreon.com/IronSheep?fan_landing=true)[Patreon.com/IronSheep](https://www.patreon.com/IronSheep?fan_landing=true)
---

Expand Down
32 changes: 16 additions & 16 deletions dist/rpi-monitor-card.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rpi-monitor-card",
"version": "1.4.1",
"version": "1.4.2",
"description": "Lovelace RPi Monitor Card",
"keywords": [
"home-assistant",
Expand Down
2 changes: 1 addition & 1 deletion src/coloring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ColorUtils {
{
color: 'red',
from: 6,
to: 100,
to: 1000000,
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const CARD_VERSION = '1.4.1';
export const CARD_VERSION = '1.4.2';

/*
* EXAMPLE attributes ISP-RPi-mqtt-daemon.py v1.7.2
Expand Down
13 changes: 11 additions & 2 deletions src/rpi-monitor-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class RPiMonitorCard extends LitElement {
private _hostname: string = '';
private _showFullCard: boolean = true;
private _useTempsInC: boolean = true;
private _latestDaemonVersions: string[] = ['v1.8.1', 'v1.6.1']; // REMOVE BEFORE FLIGHT (TEST DATA)
private _latestDaemonVersions: string[] = ['v1.8.3', 'v1.6.1']; // REMOVE BEFORE FLIGHT (TEST DATA)
private _currentDaemonVersion: string = '';
private _cardMinutesSinceUpdate: number = 0;
private _defaultTextColor: string = '';
Expand Down Expand Up @@ -434,6 +434,14 @@ export class RPiMonitorCard extends LitElement {
this._cardMinutesSinceUpdate = this._calculateRelativeMinutesSinceUpdate();
if (this._cardMinutesSinceUpdate == 0) {
cardUpdateString = 'just now';
} else if (this._cardMinutesSinceUpdate >= 1440) {
const dayCt: number = Math.round(this._cardMinutesSinceUpdate / 1440);
const suffix = dayCt == 1 ? '' : 's';
cardUpdateString = dayCt + ' day' + suffix + ' ago';
} else if (this._cardMinutesSinceUpdate >= 60) {
const hourCt: number = Math.round(this._cardMinutesSinceUpdate / 60);
const suffix = hourCt == 1 ? '' : 's';
cardUpdateString = hourCt + ' hour' + suffix + ' ago';
} else {
const suffix = this._cardMinutesSinceUpdate == 1 ? '' : 's';
cardUpdateString = this._cardMinutesSinceUpdate + ' min' + suffix + ' ago';
Expand Down Expand Up @@ -761,8 +769,9 @@ export class RPiMonitorCard extends LitElement {

private _computeOsUpdCountMessage(os_upd_ct: string): string {
// Ex 22 -> upd(22)
// if value is 0, empty string '', or '-1' then don't show value
let updateStatusMessage: string = '';
if (os_upd_ct != '' && os_upd_ct != '0') {
if (os_upd_ct != '' && os_upd_ct != '0' && os_upd_ct != '-1') {
updateStatusMessage = 'upd(' + os_upd_ct + ')';
}
return updateStatusMessage;
Expand Down

0 comments on commit 3ffe926

Please sign in to comment.