Files
ha-claude/migration_log.md
T
Gints KiršteinsandClaude Sonnet 4.6 87f078ba72 Initial commit — EMHASS + Deye + NordPool setup
- EMHASS config for Deye SUN-12K + 32 kWh battery, NordPool LV
- Day-ahead optimization automation (14:30 daily) with real battery SOC init
- Forecast vs reality template sensors and dashboard card
- Migration log from Domoticz

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 21:09:45 +03:00

3.7 KiB

Migration Log — HA + Domoticz

2026-04-06 — EMHASS Initial Configuration

Discovery completed

  • All critical Deye inverter sensors confirmed working via MQTT
  • Sign conventions verified:
    • battery_power: positive = discharging, negative = charging
    • total_grid_power: positive = import, negative = export
    • Formula: grid + pv = load + (-battery)

Sensor decisions

Role Sensor chosen Notes
PV power sensor.deye_inverter_mqtt_dc_total_power DC total (PV1+PV2)
House load sensor.load_power_no_var_loads Template sensor, ready for EV subtraction later
Grid power sensor.deye_inverter_mqtt_total_grid_power Signed, +import/-export
Battery SOC sensor.deye_inverter_mqtt_battery_soc Direct from inverter
Battery power sensor.deye_inverter_mqtt_battery_power Signed, matches EMHASS convention
Spot price sensor.nordpool_kwh_lv_eur_3_10_021 LV zone, 15-min resolution, has today/tomorrow arrays

Legacy sensors to clean up (not used in EMHASS)

  • sensor.deye_pv1_power, sensor.deye_pv1_voltage, sensor.deye_pv1_current
  • sensor.deye_pv2_power, sensor.deye_pv2_voltage, sensor.deye_pv2_current
  • sensor.deye_total_pv_power, sensor.deye_pv_day_energy, sensor.deye_total_pv_energy
  • sensor.total_ev_power, sensor.total_ev_energy (CT clamp readings, not OpenEVSE integration)
  • sensor.deye (utility meter, check if still needed)

EMHASS config written

  • File: config_emhass.yaml in this repo
  • Deploy to HA at: /config/emhass/config_emhass.yaml
  • Version targeted: v0.17.1
  • Mode: self-consumption, no grid export, no EV (to be added later)
  • Key parameters: 32 kWh battery, 11 kW charge/discharge, 16090 W grid limit, 10% min SOC

MCP setup

  • Fixed hass-mcp env var (was HATOKEN, needed HA_TOKEN)
  • Installed uv/uvx to ~/.local/bin (required by hass-mcp)
  • Config stored in ~/.claude.json (local scope, this project)

Completed — 2026-04-06

Config deployment

  • Deployed config.json to /addon_configs/5b918bf2_emhass/config.json
  • Had to find correct path (newer HA OS uses /addon_configs/{slug}/ not /homeassistant/)
  • Fixed sensor: switched to sensor.deye_inverter_mqtt_total_load_power (has history, unlike load_power_no_var_loads)

NordPool integration

  • EMHASS v0.17 has no native NordPool sensor support
  • Solution: load_cost_forecast_method: "list" + pass price array at runtime
  • Automation builds 48-value list from NordPool tomorrow attribute (resampled from 15-min to 30-min)
  • Fixed cost added: 0.1437 €/kWh (distribution + VAT)

Files updated on HA

  • /addon_configs/5b918bf2_emhass/config.json — EMHASS config
  • /homeassistant/configuration.yaml — added rest_command for EMHASS API calls
  • /homeassistant/automations.yaml — added emhass_dayahead_optimization automation

Daily automation

  • Triggers at 14:30 EET/EEST
  • Waits up to 60min for tomorrow_valid == true
  • Resamples NordPool prices, adds fixed cost, POSTs to EMHASS
  • Runs dayahead-optimpublish-data

Verified working

  • sensor.p_pv_forecast — PV forecast (W)
  • sensor.p_load_forecast — Load forecast (W)
  • sensor.p_grid_forecast — Grid import forecast (W)
  • sensor.soc_batt_forecast — Target end-of-day SOC (%)
  • sensor.unit_load_cost — First-hour price from NordPool

Remaining / Future

  1. Switch load sensor — after sensor.load_power_no_var_loads accumulates 24h+ history, switch back for more accurate EV separation
  2. OpenEVSE integration — when charger is connected, add number_of_deferrable_loads: 1 for smart EV charging
  3. Legacy sensor cleanup — remove unused sensor.deye_* duplicates from old configuration