Repository navigation
Mate 4.15.3 — The wallbox's line stays with the charge
Mate 4.15.3 — The wallbox's line stays with the charge
A change by @arekm, #419, which follows
#416, and a fix to the times under the
charts on a phone.
What changes
The wallbox's line stays with the charge (#419, @arekm)
With the wallbox enabled in Settings and Home Assistant configured, the chart of a home charge draws the
wallbox's power, the green Wallbox (AC) line, beside the car's. Until now that line was read from Home
Assistant's history each time a chart opened: it disappeared when Home Assistant purged its history
(after about 10 days by default), and reading it made a long charge's chart slow.
Now:
- at every poll of a home charge, the poller keeps the wallbox's power and counter, which it already
read for the charge's energy, in a new table,ha_samples, dated like the car's readings; - the line on the Charges page, on the Wallbox page and in the panel of the running charge is drawn from
these readings alone: opening a chart asks Home Assistant nothing. On @arekm's install the chart of a
19-hour charge answered in 0.13 s instead of 2.3 s, with the same 2,262 values; - once after the update, in the background, Mate copies the lines of the finished charges marked Home or
not yet confirmed, of every car, from what Home Assistant's history still holds. A charge older than
that history keeps no line, as before. If Home Assistant does not answer, the copy stops and is tried
again at a later start, at most once an hour; once every charge has been read it does not run again; - without the wallbox enabled or without Home Assistant, Mate asks Home Assistant nothing, as before, and
the new table stays empty.
The energy and the cost of a charge are worked out as before, from the wallbox's counter.
A custom-kWh helper that reports in Wh is priced in kWh (#419)
With the Custom kWh (Home Assistant) pricing, Mate reads the kWh to bill from a helper in Home
Assistant. A helper reporting in Wh was read as kWh, so 7,000 Wh were priced as 7,000 kWh. The figure is
now converted, as the wallbox's own readings are. A helper in kWh is read as before.
On a phone, the times under a chart no longer run into each other
The time axis of a charge's and a trip's chart asked for the same number of times on every screen, so on
a phone they were printed on top of each other. The axis now prints as many as its width holds: 4 or 5
on a phone; on a computer and a tablet, as before.
Upgrade impact
- A new table,
ha_samples, is created at the first start; nothing else is migrated. - With the wallbox and Home Assistant: after the first start Mate asks Home Assistant's history for 2
readings per earlier home or unconfirmed charge, one charge after another, in the background. The
table grows by about 2,200 rows per home charge in @arekm's figures; at 116 bytes a row, measured,
about 250 KB per charge. The GPS retention setting does not remove these rows. - Costs already stored are not recomputed. A charge confirmed or re-priced after the update with a
helper in Wh is priced in kWh. - An earlier charge marked as public at the update and changed to Home afterwards gets no line: the copy
reads only the charges marked Home or not yet confirmed.
Verification
- CI green on the tag: 5,660 passed, 1 skipped, plus 48 passed and 2 skipped on the Windows job;
the check that the released desktop shell still runs this Mate is green. - Locally, in the CI's image with Node.js and a MateDesktop checkout added: 5,660 passed, 1 skipped
(a local-only reference file the clone does not carry). - #419, checked on main for the three points found on #416: with the database locked as the web starts,
the web starts and leaves the copy to a later start; with every history read failing, the copy asks
for one charge (2 requests, where #416 asked 6) and is not recorded as done; after 50 chart reads
Python's import path is as it was. Its new tests fail on 4.15.2. Of ten parts of the change put back
one at a time, nine made a test fail; the tenth, the Wh conversion, now has its own test, which fails
on 4.15.2 (1,680 instead of 1.68). - On Mate's demo data in Chromium: a home charge whose readings are in the table draws the wallbox line
from them, at 1280 and 390 px, in the same time as before, with no page errors. On a phone the times
under the charge and trip charts ran into each other, by up to 12 px; now 4 or 5 are printed, at least
16 px apart; at 1280 px the axis is as before. The 4 phone tests of the axis fail on 4.15.2. - On a copy of a real database (one car, wallbox enabled, Home Assistant not reachable from the copy),
every page answered as on 4.15.2 and the table was created empty. - The Docker image, built from this release, ran on the test instance (one car, a real database, the
wallbox enabled, Home Assistant not set up there) before the tag: every page answers as on 4.15.2;
ha_samplesis created empty and the copy asks nothing, since there is no Home Assistant to ask; the
charts' script carries the new axis; the log has no errors. - Not tried: Firefox, a real phone, the add-on behind Home Assistant, a custom-kWh helper on a real Home
Assistant.
Italiano
Mate 4.15.3 — La linea della wallbox resta con la ricarica
Una modifica di @arekm, la #419, che segue
la #416, e una correzione delle ore sotto i
grafici sul telefono.
Cosa cambia
La linea della wallbox resta con la ricarica (#419, @arekm)
Con la wallbox attiva nelle Impostazioni e Home Assistant configurato, il grafico di una ricarica di casa
disegna la potenza della wallbox, la linea verde Wallbox (AC), accanto a quella dell'auto. Finora
quella linea veniva letta dallo storico di Home Assistant a ogni apertura del grafico: spariva quando Home
Assistant cancellava il suo storico (dopo circa 10 giorni, di default), e leggerla rendeva lento il
grafico di una ricarica lunga.
Ora:
- a ogni lettura di una ricarica di casa, il poller conserva la potenza e il contatore della wallbox, che
leggeva già per l'energia della ricarica, in una tabella nuova,ha_samples, con l'ora delle letture
dell'auto; - la linea nella pagina Ricariche, nella pagina Wallbox e nel pannello della ricarica in corso è
disegnata solo da queste letture: aprire un grafico non chiede niente a Home Assistant.
Sull'installazione di @arekm il grafico di una ricarica di 19 ore rispondeva in 0,13 s invece di
2,3 s, con gli stessi 2.262 valori; - una volta sola dopo l'aggiornamento, in background, Mate copia le linee delle ricariche finite segnate
Casa o non ancora confermate, di ogni auto, da quello che lo storico di Home Assistant ha ancora. Una
ricarica più vecchia di quello storico resta senza linea, come prima. Se Home Assistant non risponde,
la copia si ferma e riprova a un avvio successivo, al massimo una volta all'ora; quando ha letto tutte
le ricariche non riparte più; - senza la wallbox attiva o senza Home Assistant, Mate non chiede niente a Home Assistant, come prima, e
la tabella nuova resta vuota.
L'energia e il costo di una ricarica si calcolano come prima, dal contatore della wallbox.
Un helper «kWh personalizzati» che riporta i Wh viene prezzato in kWh (#419)
Con il prezzo kWh personalizzati (Home Assistant), Mate legge i kWh da fatturare da un helper di Home
Assistant. Un helper che riportava i Wh veniva letto come kWh, quindi 7.000 Wh erano prezzati come
7.000 kWh. Ora il valore viene convertito, come le letture della wallbox. Un helper in kWh viene letto
come prima.
Sul telefono, le ore sotto un grafico non si sovrappongono più
L'asse delle ore del grafico di una ricarica e di un viaggio chiedeva lo stesso numero di ore su ogni
schermo, quindi sul telefono venivano scritte una sopra l'altra. Ora l'asse ne scrive quante ne entrano
nella sua larghezza: 4 o 5 sul telefono; sul computer e sul tablet, come prima.
Impatto dell'aggiornamento
- Al primo avvio viene creata una tabella nuova,
ha_samples; nient'altro viene migrato. - Con la wallbox e Home Assistant: dopo il primo avvio Mate chiede allo storico di Home Assistant 2
letture per ogni ricarica precedente di casa o non confermata, una ricarica dopo l'altra, in
background. Nei dati di @arekm la tabella cresce di circa 2.200 righe per ricarica di casa; a 116 byte
per riga, misurati, circa 250 KB per ricarica. L'impostazione di conservazione dei punti GPS non
cancella queste righe. - I costi già salvati non vengono ricalcolati. Una ricarica confermata o ricalcolata dopo
l'aggiornamento con un helper in Wh viene prezzata in kWh. - Una ricarica precedente segnata come pubblica al momento dell'aggiornamento e cambiata in Casa dopo
resta senza linea: la copia legge solo le ricariche segnate Casa o non ancora confermate.
Verifica
- CI verde sul tag: 5.660 passati, 1 saltato, più 48 passati e 2 saltati sul job Windows; il
controllo che il guscio desktop pubblicato faccia ancora girare questa Mate è verde. - In locale, nell'immagine della CI con Node.js e una copia di MateDesktop aggiunti: 5.660 passati,
1 saltato (un file di riferimento solo locale che la copia non porta). - #419, controllata su main per i tre punti trovati sulla #416: con il database bloccato all'avvio
della web, la web parte e rimanda la copia a un avvio successivo; con tutte le letture dello storico
che falliscono, la copia chiede una sola ricarica (2 richieste, dove la #416 ne faceva 6) e non viene
segnata come fatta; dopo 50 letture di grafici il percorso di import di Python è come prima. I suoi
test nuovi falliscono sulla 4.15.2. Di dieci parti della modifica rimesse com'erano una alla volta,
nove hanno fatto fallire un test; la decima, la conversione dei Wh, ha ora un test suo, che fallisce
sulla 4.15.2 (1.680 invece di 1,68). - Sui dati dimostrativi di Mate in Chromium: una ricarica di casa con le letture nella tabella disegna
la linea della wallbox da quelle, a 1280 e a 390 px, nello stesso tempo di prima, senza errori nella
pagina. Sul telefono le ore sotto i grafici di ricariche e viaggi si sovrapponevano, fino a 12 px; ora
ne vengono scritte 4 o 5, ad almeno 16 px una dall'altra; a 1280 px l'asse è come prima. I 4 test
dell'asse sul telefono falliscono sulla 4.15.2. - Su una copia di un database vero (una sola auto, wallbox attiva, Home Assistant non raggiungibile
dalla copia), ogni pagina ha risposto come sulla 4.15.2 e la tabella è stata creata vuota. - L'immagine Docker, costruita da questa versione, ha girato sull'istanza di prova (una sola auto, un
database vero, la wallbox attiva, Home Assistant non impostato lì) prima del tag: ogni pagina risponde
come sulla 4.15.2;ha_samplesviene creata vuota e la copia non chiede niente, perché non c'è un Home
Assistant a cui chiedere; lo script dei grafici porta il nuovo asse; nel log non ci sono errori. - Non provati: Firefox, un telefono vero, l'add-on dentro Home Assistant, un helper «kWh
personalizzati» su un Home Assistant vero.