feat: Nordpool/Tibber-compatible Greenely price sensor (v2.4.0) - #3
Open
tintinz wants to merge 6 commits into
Open
feat: Nordpool/Tibber-compatible Greenely price sensor (v2.4.0)#3tintinz wants to merge 6 commits into
tintinz wants to merge 6 commits into
Conversation
…g fixes - Rewrite GreenelyApi as a fully async httpx.AsyncClient client (fixes 'Blocking call to load_verify_locations in event loop') - Add Greenely Current Price sensor (MONETARY, SEK/kWh) for the Energy dashboard and automations - Fix config flow crash on unresolvable facility (fixes '500 Internal Server Error', adds CannotConnect handling) - Move price conversion to a single testable helper (prices.py) with consistent raw->SEK/kWh mapping - Make all sensors async, fix services JSON output bug - Bump to v2.2.0, add unit tests and API verification tool
homeassistant.const in HA 2026.7 does not export CURRENCY_EURO_CENT,
which caused ImportError -> setup_error when the sensor platform loaded.
Also drop reliance on CURRENCY_SWEDISH_KRONA for safety.
Use the explicit constant UNIT_SEK_PER_KWH ("SEK/kWh") instead.
Bump to v2.2.1.
Keep only tools/verify_greenely.py which is documented in the README. Temp websocket/REST debug scripts used during troubleshooting are not meant to ship in the integration.
Greenely now provides quarter-of-hour spot prices in the hourly spot-price
payload (quarters_prices: {quarter1..quarter4}). Adds a new MONETARY sensor
`sensor.greenely_current_quarter_price` exposing the current 15-minute price
in SEK/kWh, falling back to the hourly mean when a quarter is missing.
Verified against live data (e.g. 0.398 SEK/kWh for the current quarter vs
0.4048 hourly mean). Bump to v2.3.0.
Adds a new MONETARY sensor (Greenely Nord Pool Price) that exposes Greenely's
real spot prices — including 15-minute quarter prices — in the same attribute
format as the popular Nordpool custom component and the Tibber price sensor.
An energy platform can point its EV charging / arbitrage logic from `nordpool`
or `tibber` to this sensor without changing any logic.
Exposed attributes:
- today / tomorrow and raw_today / raw_tomorrow as 96 x 15-minute [ts, price] points
- current_price, min, max, mean, average
- off_peak_1 / peak / off_peak_2 (Nordpool fixed blocks)
- low_price, price_percent_to_average, tomorrow_valid
- Tibber-style price_level (LOW/NORMAL/HIGH) and intraday_price_ranking
Implementation:
- New pure-Python module nordpool_format.py (no HA import) that expands each
hourly entry's quarters_prices {q1..q4} into 15-minute points, with fallback
to the hourly mean when a quarter is missing. Unit-testable standalone.
- Verified against live Greenely data (current 1.15 SEK/kWh, 96 pts today and
tomorrow, tomorrow_valid true) and an on-file unit test.
Bump to v2.4.0.
SEMP Meter (Solar Energy Management) parses the day-ahead curve from
today/tomorrow/raw_today/raw_tomorrow attributes and only accepts list
items that are DICTS with a "start" ISO timestamp and a "value" price
key (tariff_provider._read_prices_list). The previous tuple-pair format
([ts, price]) was silently dropped by SEM, leaving its battery/EV
planning with an empty curve and a fallback constant price.
Change build_price_series to emit each 15-min point as
{"start": "<ISO>", "value": <SEK/kWh>} for today/tomorrow and
raw_today/raw_tomorrow, keeping all other fields (current_price,
min/max/mean/average, off_peak_1/peak/off_peak_2, low_price,
price_percent_to_average, tomorrow_valid, price_level,
intraday_price_ranking) unchanged.
Now both the current-price read (state) and the full day-ahead curve
(attributes) feed SEM directly from the Greenely sensor.
Verified with a concept-proof replaying SEM's exact dict-parse logic
against the emitted attributes: 96/96 today + 96/96 raw_today points
parsed, sorted, timestamps ISO-valid.
Bump manifest to 2.4.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Nordpool/Tibber-compatible Greenely price sensor so an energy platform can use Greenely's real (VAT-inclusive) spot prices instead of Nordpool, without changing any logic.
New sensor:
sensor.greenely_nordpool_price(Greenely Nord Pool Price, MONETARY, SEK/kWh).Attribute format (matches Nordpool custom component + Tibber price sensor)
today/tomorrow— 96 × 15-minute[start_ts, price]pointsraw_today/raw_tomorrow— same seriescurrent_price,min,max,mean,averageoff_peak_1/peak/off_peak_2(Nordpool fixed blocks 00-06 / 06-22 / 22-24)low_price,price_percent_to_average,tomorrow_validprice_level(LOW/NORMAL/HIGH) andintraday_price_rankingImplementation
custom_components/greenely/nordpool_format.py(no HA import) that expands each hourly entry'squarters_prices {q1..q4}into 15-minute points, with fallback to the hourly mean when a quarter is missing → unit-testable standalone.tests/test_nordpool_format.py.Verification
tomorrow_valid: True, current price ~1.15 SEK/kWh. Unit tests pass (python3 tests/test_nordpool_format.py→ 3 passed).Design note
Kept as a separate feature commit on its own branch (off
feat/fix-and-modernize) so this is a single, gransknningsbar feature — separate from the earlier async-modernization work.