Skip to content

Commit

Permalink
names 2 props
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Oct 30, 2024
1 parent 13e95dc commit fbede48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions custom_components/xiaomi_miot/core/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ def init_converters(self):
conv = None

for p in cfg.get('converters') or []:
if not (names := p.get('names')):
if not (props := p.get('props')):
continue
for prop in service.get_properties(*names, excludes=self._exclude_miot_properties):
for prop in service.get_properties(*props, excludes=self._exclude_miot_properties):
attr = p.get('attr', prop.full_name)
c = p.get('class', MiotPropConv)
d = p.get('domain', None)
Expand Down
24 changes: 12 additions & 12 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@
],
'kwargs': {'main_props': ['status'], 'desc': True},
'converters' : [
{'names': ['fault'], 'desc': True},
{'props': ['fault'], 'desc': True},
],
},
{
Expand Down Expand Up @@ -2181,8 +2181,8 @@
'services': ['plant_monitor'],
'kwargs': {'main_props': ['status'], 'desc': True},
'converters' : [
{'names': ['fault'], 'desc': True},
{'names': ['soil_ec', 'illumination'], 'domain': 'sensor'},
{'props': ['fault'], 'desc': True},
{'props': ['soil_ec', 'illumination'], 'domain': 'sensor'},
],
},
{
Expand Down Expand Up @@ -2226,7 +2226,7 @@
'services': ['physical_control_locked', 'physical_controls_locked'],
'converters' : [
{
'names': ['physical_control_locked', 'physical_controls_locked'],
'props': ['physical_control_locked', 'physical_controls_locked'],
'domain': 'switch',
'option': {'entity_category': 'config'},
},
Expand All @@ -2235,14 +2235,14 @@
{
'services': ['tds_sensor'],
'converters' : [
{'names': ['tds_in', 'tds_out'], 'domain': 'sensor'},
{'props': ['tds_in', 'tds_out'], 'domain': 'sensor'},
],
},
{
'services': ['filter', 'filter_life'],
'converters' : [
{
'names': [
'props': [
'filter_life', 'filter_life_level',
'filter_left_time', 'filter_used_time',
'filter_left_flow', 'filter_used_flow',
Expand All @@ -2254,14 +2254,14 @@
{
'services': ['brush_cleaner'],
'converters' : [
{'names': ['brush_life_level', 'brush_left_time'], 'domain': 'sensor'},
{'props': ['brush_life_level', 'brush_left_time'], 'domain': 'sensor'},
],
},
{
'services': ['environment', 'temperature_humidity_sensor'],
'converters' : [
{
'names': [
'props': [
'temperature', 'indoor_temperature', 'relative_humidity', 'humidity',
'pm2_5_density', 'pm10_density', 'co2_density', 'tvoc_density', 'hcho_density',
'air_quality', 'air_quality_index', 'illumination', 'atmospheric_pressure',
Expand All @@ -2273,14 +2273,14 @@
{
'services': ['illumination_sensor'],
'converters' : [
{'names': ['illumination'], 'domain': 'sensor'},
{'props': ['illumination'], 'domain': 'sensor'},
],
},
{
'services': ['battery', 'power_consumption', 'electricity'],
'converters' : [
{
'names': [
'props': [
'battery_level', 'electric_power', 'electric_current',
'voltage', 'leakage_current', 'surge_power',
],
Expand All @@ -2291,9 +2291,9 @@
{
'services': ['router', 'wifi', 'guest_wifi'],
'converters' : [
{'names': ['on'], 'domain': 'switch'},
{'props': ['on'], 'domain': 'switch'},
{
'names': [
'props': [
'download_speed', 'upload_speed', 'connected_device_number', 'network_connection_type',
'ip_address', 'online_time', 'wifi_ssid', 'wifi_bandwidth',
],
Expand Down

0 comments on commit fbede48

Please sign in to comment.