Skip to content

feat: modernize Greenely integration (async API, current price sensor, bug fixes) v2.3.0 - #2

Open
tintinz wants to merge 4 commits into
masterfrom
feat/fix-and-modernize
Open

feat: modernize Greenely integration (async API, current price sensor, bug fixes) v2.3.0#2
tintinz wants to merge 4 commits into
masterfrom
feat/fix-and-modernize

Conversation

@tintinz

@tintinz tintinz commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Moderniserar Greenely Home Assistant-integrationen till v2.3.0:

  • Async API – ersätter blocking/sync-anrop med asynkron klient
  • 15-minuters (kvart) aktuellt pris-sensorsensor.greenely_current_quarter_price
  • Pris-enhetsbugg fixad (CURRENCY-konstanter, HA 2026.7-kompatibilitet)
  • Config-flöde crash fixad
  • Blocking call fixad
  • Verktygsstädning – borttagen tillfällig HA-diagnostik

Testing

  • Verifierad mot live-data: 0.398 SEK/kWh (kvart) vs 0.4048 (timmedel)
  • HACS + hassfest-CI grön

Notes

Bygger vidare på samma greenely-domän (fork, ej rename) för att undvika domänkrock.

root and others added 4 commits August 4, 2026 08:20
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant