Skip to content

Commit

Permalink
added pvAction +CODE, pvRemaining, enable/disableDelay
Browse files Browse the repository at this point in the history
  • Loading branch information
marq24 authored and marq24 committed Feb 26, 2025
1 parent e266056 commit c8bad9c
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 9 deletions.
13 changes: 11 additions & 2 deletions custom_components/evcc_intg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
import logging
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import Any

from packaging.version import Version
Expand Down Expand Up @@ -346,10 +346,19 @@ def read_tag_loadpoint(self, tag: Tag, loadpoint_idx: int = None):
if tag == Tag.PLANTIME or tag == Tag.EFFECTIVEPLANTIME:
value = self._convert_time(value)

if tag == Tag.PLANPROJECTEDSTART or tag == Tag.PLANPROJECTEDEND:
elif tag == Tag.PLANPROJECTEDSTART or tag == Tag.PLANPROJECTEDEND:
# the API already return a ISO 8601 'date' here - but we need to convert it to a datetime object
# so that it then can be finally converted by the default Sensor to a ISO 8601 date...
value = self._convert_time(value)

elif tag == Tag.PVREMAINING:
# the API just return seconds here - but we need to convert it to a datetime object so actually
# the value is 'now' + seconds...
if value != 0:
value = datetime.now(timezone.utc) + timedelta(seconds=value)
else:
value = None

return value

def read_tag_vehicle_int(self, tag: Tag, loadpoint_idx: int = None):
Expand Down
45 changes: 44 additions & 1 deletion custom_components/evcc_intg/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,27 @@ class ExtSwitchEntityDescription(SwitchEntityDescription):
native_min_value=-0.05,
native_step=0.005,
native_unit_of_measurement="@@@/kWh",
)
),
ExtNumberEntityDescriptionStub(
tag=Tag.ENABLEDELAY,
entity_category=EntityCategory.CONFIG,
icon="mdi:weather-sunset-up",
mode = NumberMode.BOX,
native_max_value=6000,
native_min_value=0,
native_step=1,
native_unit_of_measurement=UnitOfTime.SECONDS,
),
ExtNumberEntityDescriptionStub(
tag=Tag.DISABLEDELAY,
entity_category=EntityCategory.CONFIG,
icon="mdi:weather-sunset-down",
mode = NumberMode.BOX,
native_max_value=6000,
native_min_value=0,
native_step=1,
native_unit_of_measurement=UnitOfTime.SECONDS,
),
]

SELECT_SENSORS = [
Expand Down Expand Up @@ -1133,6 +1153,29 @@ class ExtSwitchEntityDescription(SwitchEntityDescription):
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
),

ExtSensorEntityDescriptionStub(
tag=Tag.PVACTION,
lookup=True,
icon="mdi:state-machine",
native_unit_of_measurement=None,
device_class=SensorDeviceClass.ENUM
),
ExtSensorEntityDescriptionStub(
tag=Tag.PVACTION,
icon="mdi:state-machine",
state_class=None,
native_unit_of_measurement=None,
device_class=SensorDeviceClass.ENUM
),
ExtSensorEntityDescriptionStub(
tag=Tag.PVREMAINING,
icon="mdi:sun-clock",
entity_category=EntityCategory.DIAGNOSTIC,
#state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.TIMESTAMP,
#device_class=None,
)
]

SWITCH_SENSORS = [
Expand Down
2 changes: 1 addition & 1 deletion custom_components/evcc_intg/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/marq24/ha-evcc/issues",
"requirements": [],
"version": "2025.2.4"
"version": "2025.2.5"
}
10 changes: 10 additions & 0 deletions custom_components/evcc_intg/pyevcc_ha/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
"scale1p": "Reduziere auf einphasig",
"scale3p": "Erhöhe auf dreiphasig",
"inactive": "-keine-"
},
"pvaction":{
"enable": "Ausreichend PV-Leistung vorhanden",
"disable": "Unzureichende PV-Leistung, Aktivierung des Timeouts",
"inactive": "Auch nach dem Timeout ist keine PV-Leistung verfügbar"
}
},
"en": {
Expand All @@ -71,6 +76,11 @@
"scale1p": "Reducing to 1-phase charging",
"scale3p": "Increasing to 3-phase charging",
"inactive": "-none-"
},
"pvaction":{
"enable": "Sufficient PV power available",
"disable": "Insufficient PV power, activating the timeout",
"inactive": "No PV power available even after the timeout"
}
}
}
9 changes: 8 additions & 1 deletion custom_components/evcc_intg/pyevcc_ha/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,15 @@ def __str__(self):

# "planOverrun": 0,
# "priority": 0,
# "pvAction": "inactive",

# "pvAction": "inactive", "activ", "disable"
PVACTION = ApiKey(key="pvAction", type=EP_TYPE.LOADPOINTS)
# "pvRemaining": 0,
PVREMAINING = ApiKey(key="pvRemaining", type=EP_TYPE.LOADPOINTS)
# "enableDelay": 60,
ENABLEDELAY = ApiKey(key="enableDelay", write_key="enable/delay", type=EP_TYPE.LOADPOINTS)
# "disableDelay": 180,
DISABLEDELAY = ApiKey(key="disableDelay", write_key="disable/delay", type=EP_TYPE.LOADPOINTS)

# "sessionCo2PerKWh": null,
SESSIONCO2PERKWH = ApiKey(key="sessionCo2PerKWh", type=EP_TYPE.LOADPOINTS)
Expand Down
10 changes: 8 additions & 2 deletions custom_components/evcc_intg/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
"residualpower": {"name": "Restleistung"},
"smartcostlimit_co2": {"name": "CO₂ Limit ≤"},
"smartcostlimit": {"name": "@@@ Limit ≤"},
"batterygridchargelimit": {"name": "Hausbatterie: Netzladen @@@ Limit ≤"}
"batterygridchargelimit": {"name": "Hausbatterie: Netzladen @@@ Limit ≤"},
"enabledelay": {"name": "Verzögerung Aktivierung"},
"disabledelay": {"name": "Verzögerung Deaktivierung"}
},
"select": {
"prioritysoc": {
Expand Down Expand Up @@ -285,7 +287,11 @@
"stat30avgco2": {"name": "Statistik: letzten 30 Tage Ø CO₂"},

"tariff_api_solar": {"name": "Solar Prognose"},
"tariff_api_grid": {"name": "Strom Tarife"}
"tariff_api_grid": {"name": "Strom Tarife"},

"pvaction": {"name": "PV Aktivität [CODE]"},
"pvaction_value": {"name": "PV Aktivität"},
"pvremaining": {"name": "PV verbleibend"}
},
"switch": {
"batterydischargecontrol": {"name": "Hausbatterie: Entladesperre"},
Expand Down
10 changes: 8 additions & 2 deletions custom_components/evcc_intg/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
"residualpower": {"name": "Residual power"},
"smartcostlimit_co2": {"name": "CO₂ limit ≤"},
"smartcostlimit": {"name": "@@@ limit ≤"},
"batterygridchargelimit": {"name": "Home-Battery: grid charging @@@ limit ≤"}
"batterygridchargelimit": {"name": "Home-Battery: grid charging @@@ limit ≤"},
"enabledelay": {"name": "Delay Enable"},
"disabledelay": {"name": "Delay Disable"}
},
"select": {
"prioritysoc": {
Expand Down Expand Up @@ -355,7 +357,11 @@
"stat30avgco2": {"name": "Statistics: Last 30 days Ø CO₂"},

"tariff_api_solar": {"name": "Solar Prognoses"},
"tariff_api_grid": {"name": "Grid Tariffs"}
"tariff_api_grid": {"name": "Grid Tariffs"},

"pvaction": {"name": "PV Action [CODE]"},
"pvaction_value": {"name": "PV Action"},
"pvremaining": {"name": "PV Remaining"}
},
"switch": {
"batterydischargecontrol": {"name": "Home-Battery: discharge lock"},
Expand Down

0 comments on commit c8bad9c

Please # to comment.