mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-05-09 01:34:49 +08:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
00f24bd3e1 | ||
|
f384034854 | ||
|
b0204ad9b7 | ||
|
b4ece958ac | ||
|
db77af8a13 | ||
|
a9f1fc630d | ||
|
51a27a1e30 | ||
|
2e0ea642a4 | ||
|
80d962897a | ||
|
d17784070d | ||
|
218c96e5e6 | ||
|
eacc0d02da |
@ -1,4 +1,12 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
## v0.3.1
|
||||||
|
### Changed
|
||||||
|
- Setting the fan speed level when the fan is off will turning the fan on first. [#1031](https://github.com/XiaoMi/ha_xiaomi_home/pull/1031)
|
||||||
|
### Fixed
|
||||||
|
- Fix update device list error when there is no shared devices. [#1024](https://github.com/XiaoMi/ha_xiaomi_home/pull/1024)
|
||||||
|
- Fix the humidifier get_prop_value error when the property is None. [#1035](https://github.com/XiaoMi/ha_xiaomi_home/pull/1035)
|
||||||
|
- Fix the MIoT-Spec-V2 of zhimi.fan.v3 fan-level, cuco.plug.cp1md voltage and current, zimi.plug.zncz01 electric-power, giot.plug.v8icm power-consumption unit, yunmi.kettle.r3 tds unit, and dmaker.fan.p5 fan-level. [#1037](https://github.com/XiaoMi/ha_xiaomi_home/pull/1037)
|
||||||
|
|
||||||
## v0.3.0
|
## v0.3.0
|
||||||
注意:v0.3.0 变更了部分实体 unique_id 的生成规则,如果勾选 xiaomi_home > 配置 > 更新实体转换规则,会导致部分实体已配置的自动化失效。如果想要避免重新配置大量自动化,可使用这个[补丁](https://github.com/XiaoMi/ha_xiaomi_home/pull/972)。
|
注意:v0.3.0 变更了部分实体 unique_id 的生成规则,如果勾选 xiaomi_home > 配置 > 更新实体转换规则,会导致部分实体已配置的自动化失效。如果想要避免重新配置大量自动化,可使用这个[补丁](https://github.com/XiaoMi/ha_xiaomi_home/pull/972)。
|
||||||
|
|
||||||
@ -7,7 +15,6 @@ CAUTION: v0.3.0 changes the unique_id of some entities. If you check the option
|
|||||||
- Import the devices in the shared homes and the separated shared devices. [#1021](https://github.com/XiaoMi/ha_xiaomi_home/pull/1021)
|
- Import the devices in the shared homes and the separated shared devices. [#1021](https://github.com/XiaoMi/ha_xiaomi_home/pull/1021)
|
||||||
- Support _attr_hvac_action of the climate entity. [#956](https://github.com/XiaoMi/ha_xiaomi_home/pull/956)
|
- Support _attr_hvac_action of the climate entity. [#956](https://github.com/XiaoMi/ha_xiaomi_home/pull/956)
|
||||||
- Add custom defined MIoT-Spec-V2 instance via spec_add.json. [#953](https://github.com/XiaoMi/ha_xiaomi_home/pull/953)
|
- Add custom defined MIoT-Spec-V2 instance via spec_add.json. [#953](https://github.com/XiaoMi/ha_xiaomi_home/pull/953)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Ignore 'Event loop is closed' when unsub a closed event loop. [#991](https://github.com/XiaoMi/ha_xiaomi_home/pull/991)
|
- Ignore 'Event loop is closed' when unsub a closed event loop. [#991](https://github.com/XiaoMi/ha_xiaomi_home/pull/991)
|
||||||
- Fix contact-state for linp.magnet.m1 and loock.safe.v1. [#977](https://github.com/XiaoMi/ha_xiaomi_home/pull/977)
|
- Fix contact-state for linp.magnet.m1 and loock.safe.v1. [#977](https://github.com/XiaoMi/ha_xiaomi_home/pull/977)
|
||||||
|
@ -567,6 +567,8 @@ class XiaomiMihomeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
# home list
|
# home list
|
||||||
for device_source in ['home_list','share_home_list',
|
for device_source in ['home_list','share_home_list',
|
||||||
'separated_shared_list']:
|
'separated_shared_list']:
|
||||||
|
if device_source not in self._cc_home_info['homes']:
|
||||||
|
continue
|
||||||
for home_id, home_info in self._cc_home_info[
|
for home_id, home_info in self._cc_home_info[
|
||||||
'homes'][device_source].items():
|
'homes'][device_source].items():
|
||||||
# i18n
|
# i18n
|
||||||
@ -665,6 +667,8 @@ class XiaomiMihomeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
'no_family_selected')
|
'no_family_selected')
|
||||||
for device_source in ['home_list','share_home_list',
|
for device_source in ['home_list','share_home_list',
|
||||||
'separated_shared_list']:
|
'separated_shared_list']:
|
||||||
|
if device_source not in self._cc_home_info['homes']:
|
||||||
|
continue
|
||||||
for home_id, home_info in self._cc_home_info[
|
for home_id, home_info in self._cc_home_info[
|
||||||
'homes'][device_source].items():
|
'homes'][device_source].items():
|
||||||
if home_id in home_selected:
|
if home_id in home_selected:
|
||||||
@ -1427,6 +1431,8 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
# home list
|
# home list
|
||||||
for device_source in ['home_list','share_home_list',
|
for device_source in ['home_list','share_home_list',
|
||||||
'separated_shared_list']:
|
'separated_shared_list']:
|
||||||
|
if device_source not in self._cc_home_info['homes']:
|
||||||
|
continue
|
||||||
for home_id, home_info in self._cc_home_info[
|
for home_id, home_info in self._cc_home_info[
|
||||||
'homes'][device_source].items():
|
'homes'][device_source].items():
|
||||||
# i18n
|
# i18n
|
||||||
@ -1469,6 +1475,8 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
self._home_selected = {}
|
self._home_selected = {}
|
||||||
for device_source in ['home_list','share_home_list',
|
for device_source in ['home_list','share_home_list',
|
||||||
'separated_shared_list']:
|
'separated_shared_list']:
|
||||||
|
if device_source not in self._cc_home_info['homes']:
|
||||||
|
continue
|
||||||
for home_id, home_info in self._cc_home_info[
|
for home_id, home_info in self._cc_home_info[
|
||||||
'homes'][device_source].items():
|
'homes'][device_source].items():
|
||||||
if home_id in self._home_selected_list:
|
if home_id in self._home_selected_list:
|
||||||
|
@ -236,6 +236,9 @@ class Fan(MIoTServiceEntity, FanEntity):
|
|||||||
async def async_set_percentage(self, percentage: int) -> None:
|
async def async_set_percentage(self, percentage: int) -> None:
|
||||||
"""Set the percentage of the fan speed."""
|
"""Set the percentage of the fan speed."""
|
||||||
if percentage > 0:
|
if percentage > 0:
|
||||||
|
if not self.is_on:
|
||||||
|
# If the fan is off, turn it on.
|
||||||
|
await self.set_property_async(prop=self._prop_on, value=True)
|
||||||
if self._speed_names:
|
if self._speed_names:
|
||||||
await self.set_property_async(
|
await self.set_property_async(
|
||||||
prop=self._prop_fan_level,
|
prop=self._prop_fan_level,
|
||||||
@ -249,9 +252,6 @@ class Fan(MIoTServiceEntity, FanEntity):
|
|||||||
value=int(percentage_to_ranged_value(
|
value=int(percentage_to_ranged_value(
|
||||||
low_high_range=(self._speed_min, self._speed_max),
|
low_high_range=(self._speed_min, self._speed_max),
|
||||||
percentage=percentage)))
|
percentage=percentage)))
|
||||||
if not self.is_on:
|
|
||||||
# If the fan is off, turn it on.
|
|
||||||
await self.set_property_async(prop=self._prop_on, value=True)
|
|
||||||
else:
|
else:
|
||||||
await self.set_property_async(prop=self._prop_on, value=False)
|
await self.set_property_async(prop=self._prop_on, value=False)
|
||||||
|
|
||||||
|
@ -52,11 +52,10 @@ from typing import Any, Optional
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.components.humidifier import (
|
from homeassistant.components.humidifier import (HumidifierEntity,
|
||||||
HumidifierEntity,
|
|
||||||
HumidifierDeviceClass,
|
HumidifierDeviceClass,
|
||||||
HumidifierEntityFeature
|
HumidifierEntityFeature,
|
||||||
)
|
HumidifierAction)
|
||||||
|
|
||||||
from .miot.miot_spec import MIoTSpecProperty
|
from .miot.miot_spec import MIoTSpecProperty
|
||||||
from .miot.miot_device import MIoTDevice, MIoTEntityData, MIoTServiceEntity
|
from .miot.miot_device import MIoTDevice, MIoTEntityData, MIoTServiceEntity
|
||||||
@ -82,8 +81,8 @@ async def async_setup_entry(
|
|||||||
Humidifier(miot_device=miot_device, entity_data=data))
|
Humidifier(miot_device=miot_device, entity_data=data))
|
||||||
for data in miot_device.entity_list.get('dehumidifier', []):
|
for data in miot_device.entity_list.get('dehumidifier', []):
|
||||||
data.device_class = HumidifierDeviceClass.DEHUMIDIFIER
|
data.device_class = HumidifierDeviceClass.DEHUMIDIFIER
|
||||||
new_entities.append(Humidifier(
|
new_entities.append(
|
||||||
miot_device=miot_device, entity_data=data))
|
Humidifier(miot_device=miot_device, entity_data=data))
|
||||||
|
|
||||||
if new_entities:
|
if new_entities:
|
||||||
async_add_entities(new_entities)
|
async_add_entities(new_entities)
|
||||||
@ -99,9 +98,8 @@ class Humidifier(MIoTServiceEntity, HumidifierEntity):
|
|||||||
|
|
||||||
_mode_map: dict[Any, Any]
|
_mode_map: dict[Any, Any]
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, miot_device: MIoTDevice,
|
||||||
self, miot_device: MIoTDevice, entity_data: MIoTEntityData
|
entity_data: MIoTEntityData) -> None:
|
||||||
) -> None:
|
|
||||||
"""Initialize the Humidifier."""
|
"""Initialize the Humidifier."""
|
||||||
super().__init__(miot_device=miot_device, entity_data=entity_data)
|
super().__init__(miot_device=miot_device, entity_data=entity_data)
|
||||||
self._attr_device_class = entity_data.device_class
|
self._attr_device_class = entity_data.device_class
|
||||||
@ -130,12 +128,10 @@ class Humidifier(MIoTServiceEntity, HumidifierEntity):
|
|||||||
# mode
|
# mode
|
||||||
elif prop.name == 'mode':
|
elif prop.name == 'mode':
|
||||||
if not prop.value_list:
|
if not prop.value_list:
|
||||||
_LOGGER.error(
|
_LOGGER.error('mode value_list is None, %s', self.entity_id)
|
||||||
'mode value_list is None, %s', self.entity_id)
|
|
||||||
continue
|
continue
|
||||||
self._mode_map = prop.value_list.to_map()
|
self._mode_map = prop.value_list.to_map()
|
||||||
self._attr_available_modes = list(
|
self._attr_available_modes = list(self._mode_map.values())
|
||||||
self._mode_map.values())
|
|
||||||
self._attr_supported_features |= HumidifierEntityFeature.MODES
|
self._attr_supported_features |= HumidifierEntityFeature.MODES
|
||||||
self._prop_mode = prop
|
self._prop_mode = prop
|
||||||
# relative-humidity
|
# relative-humidity
|
||||||
@ -152,33 +148,45 @@ class Humidifier(MIoTServiceEntity, HumidifierEntity):
|
|||||||
|
|
||||||
async def async_set_humidity(self, humidity: int) -> None:
|
async def async_set_humidity(self, humidity: int) -> None:
|
||||||
"""Set new target humidity."""
|
"""Set new target humidity."""
|
||||||
await self.set_property_async(
|
if self._prop_target_humidity is None:
|
||||||
prop=self._prop_target_humidity, value=humidity)
|
return
|
||||||
|
await self.set_property_async(prop=self._prop_target_humidity,
|
||||||
|
value=humidity)
|
||||||
|
|
||||||
async def async_set_mode(self, mode: str) -> None:
|
async def async_set_mode(self, mode: str) -> None:
|
||||||
"""Set new target preset mode."""
|
"""Set new target preset mode."""
|
||||||
await self.set_property_async(
|
await self.set_property_async(prop=self._prop_mode,
|
||||||
prop=self._prop_mode,
|
value=self.get_map_key(
|
||||||
value=self.get_map_key(map_=self._mode_map, value=mode))
|
map_=self._mode_map, value=mode))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> Optional[bool]:
|
def is_on(self) -> Optional[bool]:
|
||||||
"""Return if the humidifier is on."""
|
"""Return if the humidifier is on."""
|
||||||
return self.get_prop_value(prop=self._prop_on)
|
return self.get_prop_value(prop=self._prop_on)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def action(self) -> Optional[HumidifierAction]:
|
||||||
|
"""Return the current status of the device."""
|
||||||
|
if not self.is_on:
|
||||||
|
return HumidifierAction.OFF
|
||||||
|
if self._attr_device_class == HumidifierDeviceClass.HUMIDIFIER:
|
||||||
|
return HumidifierAction.HUMIDIFYING
|
||||||
|
return HumidifierAction.DRYING
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_humidity(self) -> Optional[int]:
|
def current_humidity(self) -> Optional[int]:
|
||||||
"""Return the current humidity."""
|
"""Return the current humidity."""
|
||||||
return self.get_prop_value(prop=self._prop_humidity)
|
return (self.get_prop_value(
|
||||||
|
prop=self._prop_humidity) if self._prop_humidity else None)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_humidity(self) -> Optional[int]:
|
def target_humidity(self) -> Optional[int]:
|
||||||
"""Return the target humidity."""
|
"""Return the target humidity."""
|
||||||
return self.get_prop_value(prop=self._prop_target_humidity)
|
return (self.get_prop_value(prop=self._prop_target_humidity)
|
||||||
|
if self._prop_target_humidity else None)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mode(self) -> Optional[str]:
|
def mode(self) -> Optional[str]:
|
||||||
"""Return the current preset mode."""
|
"""Return the current preset mode."""
|
||||||
return self.get_map_value(
|
return self.get_map_value(map_=self._mode_map,
|
||||||
map_=self._mode_map,
|
|
||||||
key=self.get_prop_value(prop=self._prop_mode))
|
key=self.get_prop_value(prop=self._prop_mode))
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"cryptography",
|
"cryptography",
|
||||||
"psutil"
|
"psutil"
|
||||||
],
|
],
|
||||||
"version": "v0.3.0",
|
"version": "v0.3.1",
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
"_miot-central._tcp.local."
|
"_miot-central._tcp.local."
|
||||||
]
|
]
|
||||||
|
@ -779,8 +779,10 @@ class MIoTDevice:
|
|||||||
# pylint: disable=import-outside-toplevel
|
# pylint: disable=import-outside-toplevel
|
||||||
from homeassistant.const import UnitOfConductivity # type: ignore
|
from homeassistant.const import UnitOfConductivity # type: ignore
|
||||||
unit_map['μS/cm'] = UnitOfConductivity.MICROSIEMENS_PER_CM
|
unit_map['μS/cm'] = UnitOfConductivity.MICROSIEMENS_PER_CM
|
||||||
|
unit_map['mWh'] = UnitOfEnergy.MILLIWATT_HOUR
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
unit_map['μS/cm'] = 'μS/cm'
|
unit_map['μS/cm'] = 'μS/cm'
|
||||||
|
unit_map['mWh'] = 'mWh'
|
||||||
|
|
||||||
return unit_map.get(spec_unit, None)
|
return unit_map.get(spec_unit, None)
|
||||||
|
|
||||||
|
@ -47,9 +47,15 @@ urn:miot-spec-v2:device:bath-heater:0000A028:opple-acmoto:1:
|
|||||||
urn:miot-spec-v2:device:bath-heater:0000A028:xiaomi-s1:1:
|
urn:miot-spec-v2:device:bath-heater:0000A028:xiaomi-s1:1:
|
||||||
prop.4.4:
|
prop.4.4:
|
||||||
name: fan-level-ventilation
|
name: fan-level-ventilation
|
||||||
|
urn:miot-spec-v2:device:fan:0000A005:dmaker-p5:1:
|
||||||
|
prop.2.6:
|
||||||
|
name: fan-level-a
|
||||||
urn:miot-spec-v2:device:fan:0000A005:xiaomi-p51:1:
|
urn:miot-spec-v2:device:fan:0000A005:xiaomi-p51:1:
|
||||||
prop.2.2:
|
prop.2.2:
|
||||||
name: fan-level-a
|
name: fan-level-a
|
||||||
|
urn:miot-spec-v2:device:fan:0000A005:zhimi-v3:3:
|
||||||
|
prop.2.6:
|
||||||
|
name: fan-level-a
|
||||||
urn:miot-spec-v2:device:gateway:0000A019:lumi-mcn001:1:
|
urn:miot-spec-v2:device:gateway:0000A019:lumi-mcn001:1:
|
||||||
prop.2.1:
|
prop.2.1:
|
||||||
access:
|
access:
|
||||||
@ -81,10 +87,13 @@ urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1:
|
|||||||
- notify
|
- notify
|
||||||
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:2: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:2: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
||||||
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:3: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:3: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
||||||
|
urn:miot-spec-v2:device:kettle:0000A009:yunmi-r3:1:
|
||||||
|
prop.3.1:
|
||||||
|
unit: ppm
|
||||||
urn:miot-spec-v2:device:light:0000A001:shhf-sfla12:1:
|
urn:miot-spec-v2:device:light:0000A001:shhf-sfla12:1:
|
||||||
prop.8.11:
|
prop.8.11:
|
||||||
name: on-a
|
name: on-a
|
||||||
urn:miot-spec-v2:device:magnet-sensor:0000A016:linp-m1:1: # linp.magnet.m1
|
urn:miot-spec-v2:device:magnet-sensor:0000A016:linp-m1:1:
|
||||||
prop.2.1004:
|
prop.2.1004:
|
||||||
name: contact-state
|
name: contact-state
|
||||||
expr: src_value!=1
|
expr: src_value!=1
|
||||||
@ -109,6 +118,10 @@ urn:miot-spec-v2:device:outlet:0000A002:cuco-cp1md:1:
|
|||||||
prop.2.2:
|
prop.2.2:
|
||||||
name: power-consumption
|
name: power-consumption
|
||||||
expr: round(src_value/1000, 3)
|
expr: round(src_value/1000, 3)
|
||||||
|
prop.2.3:
|
||||||
|
expr: round(src_value/10, 1)
|
||||||
|
prop.2.4:
|
||||||
|
unit: mA
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:1: urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2
|
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:1: urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2:
|
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2:
|
||||||
prop.2.3:
|
prop.2.3:
|
||||||
@ -122,11 +135,15 @@ urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:1:
|
|||||||
name: power-consumption
|
name: power-consumption
|
||||||
expr: round(src_value/100, 2)
|
expr: round(src_value/100, 2)
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:2: urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:1
|
urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:2: urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:1
|
||||||
|
urn:miot-spec-v2:device:outlet:0000A002:giot-v8icm:1:0000C816:
|
||||||
|
prop.4.1:
|
||||||
|
unit: mWh
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:qmi-psv3:1:0000C816:
|
urn:miot-spec-v2:device:outlet:0000A002:qmi-psv3:1:0000C816:
|
||||||
prop.3.3:
|
prop.3.3:
|
||||||
unit: mV
|
unit: mV
|
||||||
prop.3.4:
|
prop.3.4:
|
||||||
unit: mA
|
unit: mA
|
||||||
|
urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:1:0000C816: urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:2:0000C816
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:2:0000C816:
|
urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:2:0000C816:
|
||||||
prop.3.1:
|
prop.3.1:
|
||||||
name: electric-power
|
name: electric-power
|
||||||
@ -151,7 +168,7 @@ urn:miot-spec-v2:device:router:0000A036:xiaomi-rd08:1:
|
|||||||
name: upload-speed
|
name: upload-speed
|
||||||
icon: mdi:upload
|
icon: mdi:upload
|
||||||
unit: B/s
|
unit: B/s
|
||||||
urn:miot-spec-v2:device:safe-box:0000A042:loock-v1:1: # loock.safe.v1
|
urn:miot-spec-v2:device:safe-box:0000A042:loock-v1:1:
|
||||||
prop.5.1:
|
prop.5.1:
|
||||||
name: contact-state
|
name: contact-state
|
||||||
expr: src_value!=1
|
expr: src_value!=1
|
||||||
|
@ -389,6 +389,7 @@ SPEC_SERVICE_TRANS_MAP: dict = {
|
|||||||
'fan-control': 'fan',
|
'fan-control': 'fan',
|
||||||
'ceiling-fan': 'fan',
|
'ceiling-fan': 'fan',
|
||||||
'air-fresh': 'fan',
|
'air-fresh': 'fan',
|
||||||
|
'air-purifier': 'fan',
|
||||||
'water-heater': {
|
'water-heater': {
|
||||||
'required': {
|
'required': {
|
||||||
'properties': {
|
'properties': {
|
||||||
|
@ -38,7 +38,7 @@ def load_json_file(file_path: str) -> Optional[dict]:
|
|||||||
|
|
||||||
def save_json_file(file_path: str, data: dict) -> None:
|
def save_json_file(file_path: str, data: dict) -> None:
|
||||||
with open(file_path, 'w', encoding='utf-8') as file:
|
with open(file_path, 'w', encoding='utf-8') as file:
|
||||||
json.dump(data, file, ensure_ascii=False, indent=4)
|
json.dump(data, file, ensure_ascii=False, indent=2)
|
||||||
|
|
||||||
|
|
||||||
def load_yaml_file(file_path: str) -> Optional[dict]:
|
def load_yaml_file(file_path: str) -> Optional[dict]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user