Skip to content

Commit

Permalink
testing translation
Browse files Browse the repository at this point in the history
  • Loading branch information
jontofront authored Dec 13, 2023
1 parent 5d8bf11 commit b37a51a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
18 changes: 12 additions & 6 deletions custom_components/econet300/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"1031": "mixerTemp1",
"1287": "mixerSetTemp1",
"1792": "mode",
"1794": "boiler_power",
"1794": "boilerPower",
"1795": "fanPower",
"1280": "tempCOSet",
}
Expand All @@ -132,14 +132,13 @@
"mixerTemp1": UnitOfTemperature.CELSIUS,
"tempBack": UnitOfTemperature.CELSIUS,
"tempCWU": UnitOfTemperature.CELSIUS,
"boiler_power": PERCENTAGE,
"boilerPower": PERCENTAGE,
"fuelLevel": PERCENTAGE,
"tempUpperBuffer": UnitOfTemperature.CELSIUS,
"tempLowerBuffer": UnitOfTemperature.CELSIUS,
"signal": SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
"quality": PERCENTAGE,
"valveMixer1": PERCENTAGE,

}

REG_PARAM_STATE_CLASS = {
Expand Down Expand Up @@ -168,7 +167,7 @@
"tempExternalSensor": SensorDeviceClass.TEMPERATURE,
"tempCO": SensorDeviceClass.TEMPERATURE,
"tempCOSet": SensorDeviceClass.TEMPERATURE,
"boiler_power": SensorDeviceClass.POWER_FACTOR,
"boilerPower": SensorDeviceClass.POWER_FACTOR,
"fanPower": SensorDeviceClass.POWER_FACTOR,
"tempFlueGas": SensorDeviceClass.TEMPERATURE,
"mixerSetTemp1": SensorDeviceClass.TEMPERATURE,
Expand Down Expand Up @@ -197,7 +196,7 @@
"tempExternalSensor": 1,
"fuelLevel": 0,
"lambdaLevel": 1,
"lambdaSet":1,
"lambdaSet": 1,
"tempCO": 1,
"tempCOSet": 0,
"fanPower": 0,
Expand All @@ -208,7 +207,7 @@
"tempLowerBuffer": 1,
"tempCWU": 1,
"tempFlueGas": 1,
}
}

REG_PARAM_VALUE_PROCESSOR = {
"mode": lambda x: OPERATION_MODE_NAMES.get(x, "Unknown"),
Expand Down Expand Up @@ -239,3 +238,10 @@
"tempUpperBuffer": False,
"tempLowerBuffer": False,
}

REG_PARAM_TRANSLATION_KEY = {
"boilerPower": "boiler_power",
"tempExternalSensor": "temp_external_sensor",
"tempFeeder": "temp_feeder",
"fuelLevel": "fuel_fevel",
}
3 changes: 2 additions & 1 deletion custom_components/econet300/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DOMAIN,
REG_PARAM_DEVICE_CLASS,
REG_PARAM_STATE_CLASS,
REG_PARAM_TRANSLATION_KEY,
SERVICE_COORDINATOR,
SERVICE_API,
REG_PARAM_MAP,
Expand Down Expand Up @@ -79,7 +80,7 @@ def create_entity_description(key: str):
return EconetSensorEntityDescription(
key=key,
name=map_key,
translation_key=camel_to_snake(map_key),
translation_key=REG_PARAM_TRANSLATION_KEY.get(map_key, None),
native_unit_of_measurement=REG_PARAM_UNIT.get(map_key, None),
state_class=REG_PARAM_STATE_CLASS.get(map_key, None),
device_class=REG_PARAM_DEVICE_CLASS.get(map_key, None),
Expand Down
2 changes: 1 addition & 1 deletion custom_components/econet300/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"lambda_set": { "name": "lambda Set" },
"lambda_level": { "name": "lambda Level" },
"signal": { "name": "signaliukas" },
"temp_co": { "name": "tempCOukas" },
"temp_c": { "name": "tempCOukas" },
"temp_cwu": { "name": "tempCWUiukas" },
"temp_upper_buffer": { "name": "tempUpper Buffer" },
"temp_lower_buffer": { "name": "tempLower Buffer" },
Expand Down

0 comments on commit b37a51a

Please sign in to comment.