Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Фикс режима работы и установки температуры #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions custom_components/turkov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def _migrate_callback(ent: RegistryEntry) -> dict[str, Any] | None:
"air_quality",
"filter_life_percentage",
"outdoor_temperature",
"exhaust_temperature",
):
if ent.unique_id.endswith(postfix):
return {
Expand Down
4 changes: 3 additions & 1 deletion custom_components/turkov/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ def _float_less(x):
"indoor_temperature": ("in_temp", _float_less),
"image_url": ("image", False),
"indoor_humidity": ("in_humid", _float_less),
"exhaust_temperature": ("exh_temp", _float_less),
"air_pressure": ("air_pres", float),
"co2_level": ("CO2_level", float),
"current_temperature": ("temp_curr", _float_less),
Expand Down Expand Up @@ -669,6 +670,7 @@ def __init__(
self.setup: Optional[str] = None
self.air_pressure: Optional[float] = None
self.indoor_humidity: Optional[float] = None
self.exhaust_temperature: Optional[float] = None
self.co2_level: Optional[float] = None
self.current_temperature: Optional[float] = None
self.current_humidity: Optional[float] = None
Expand Down Expand Up @@ -761,7 +763,7 @@ async def set_value_local(self, key: str, value: Any) -> None:
request_url = self.base_url + "/command"
_LOGGER.debug(f"[{self}] Sending `{key}`=`{value}` (type: {type(value)}) to endpoint {request_url}")
async with self.session.post(
self.base_url + "/command", json={key: value}
self.base_url + "/command", data="{" + key + ": \"" + str(value) + "\"}"
) as response:
data = await response.json(content_type=None)
_LOGGER.debug(f"[{self}] Received local command result: {data}")
Expand Down
2 changes: 0 additions & 2 deletions custom_components/turkov/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
# Device calls
if not device.is_on:
await device.turn_on()
if not device.is_heater_on:
await device.turn_on_heater()
await device.set_target_temperature(kwargs[ATTR_TEMPERATURE])

# Refresh call
Expand Down
7 changes: 7 additions & 0 deletions custom_components/turkov/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ class TurkovSensorEntityDescription(
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
TurkovSensorEntityDescription(
key="exhaust_temperature",
name="Exhaust Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
),
)


Expand Down
3 changes: 3 additions & 0 deletions custom_components/turkov/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
},
"air_pressure": {
"name": "Атмосферное давление"
},
"exhaust_temperature": {
"name": "Температура вытяжного воздуха"
}
},
"switch": {
Expand Down