Skip to content

v0.2.0 — the euro value was overstating your balance

Choose a tag to compare

@yodax yodax released this 07 Sep 08:39
· 8 commits to main since this release

Two behaviour changes: the euro sensor was wrong, and polling is much gentler.

The euro value was ~5% too high

"Points balance value" overstated your balance and now reports what the
points actually buy.
A balance of 10 000 points read as € 100,00; the
same points buy € 95,24 of gift cards in the webshop.

The API has a field called trapperToEuroConversionRatio, and v0.1.x used it.
It is a real field, it is named like the answer, and it is not the answer — it
reproduces the scheme's own purchase price, which sits above shop prices by
the operator's margin. Across the whole catalogue, purchasePrice divided by
trappersPrice is exactly that ratio for every single article, so it can
never tell you anything about what a thing costs to buy.

The sensor now reads the webshop catalogue and works out the rate that can
actually be spent: a "bol. cadeaukaart € 25" costing 2625 points is 105 points
per euro. The rate is read from your own employer's catalogue every time —
it is a contract term and it differs between employers, so nothing is
hardcoded.

Gift cards are deliberately the yardstick because they are the best rate
in the shop; physical goods run around 131 points per euro of their supplier
price. So the sensor reports the best achievable value of your balance.

If the catalogue ever stops having one consistent rate, the sensor reads
unknown rather than reporting an average that would buy nothing.

Credit where it is due: this was caught by a human noticing that the sensor
disagreed with a real listing in the shop. Both numbers were internally
consistent; nothing in the API alone would have given it away.

Polling: five times a day, none overnight

Was every 30 minutes. Now 08:00, 11:00, 14:00, 17:00 and 20:00 in your
Home Assistant timezone — about 20 requests a day instead of 192.

Points are credited at most once per working day, when the collector unit
reads your bike tag as you arrive at the office, so there is nothing to see
between 20:00 and 08:00. Fixed wall-clock slots rather than a rolling timer,
so "when does it poll?" does not depend on when you last restarted Home
Assistant.

Your sensors keep their values overnight — they do not go unavailable. A
restart at any hour still loads them immediately, and
homeassistant.update_entity or the entry's reload button still forces a
refresh whenever you want one.

Privacy

The integration no longer calls the orders endpoint at all. It was only ever
read for that conversion ratio, and it is the one endpoint in this API that
returns a bank account number and the ordering person's name. Removing a
request for data nothing needed is the better half of this release.

Upgrading

Nothing to do — no entity IDs change and no reconfiguration is needed. The
euro sensor will simply read a lower, correct number after the next poll.

Upgrading from v0.1.0 specifically: entity IDs changed in v0.1.1, so see
that release's note as well.