Skip to content

Commit

Permalink
🧊 improve for fridge (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Mar 27, 2024
1 parent 01c2ed8 commit 73225c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 4 additions & 0 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1763,6 +1763,10 @@
'select_properties': 'heat_level,motor_control',
'number_properties': 'target_time,target_temperature',
},
'*.fridge.*': {
'switch_properties': 'on',
'number_properties': 'target_temperature',
},
'*.heater.*': {
'switch_properties': 'heater.on,horizontal_swing,alarm.alarm,delay.delay',
'number_properties': 'countdown_time,delay_time',
Expand Down
7 changes: 1 addition & 6 deletions custom_components/xiaomi_miot/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async def async_update_for_main_entity(self):
)
self._update_sub_entities(
['on'],
[self._miot_service.name, 'router', 'wifi', 'guest_wifi', 'fridge_chamber'],
[self._miot_service.name, 'router', 'wifi', 'guest_wifi'],
domain='switch',
)
self._update_sub_entities(
Expand All @@ -313,11 +313,6 @@ async def async_update_for_main_entity(self):
['bed', 'backrest_control', 'leg_rest_control'],
domain='cover',
)
self._update_sub_entities(
['target_temperature'],
['fridge_chamber'],
domain='number',
)

@property
def device_class(self):
Expand Down

2 comments on commit 73225c2

@chunfengyao
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this patch ,it still not work for this issue.

in the file '.storage/core.entity_registry'.
item "entity_id": "sensor.midjd6_540_bf5b_refrigerating_chamber", and "entity_id": "sensor.midjd6_540_bf5b_freezing_chamber", has the same config_entry_id and device_id.

this json in the file '.storage/core.entity_registry' looks like:

{
        "aliases": [],
        "area_id": null,
        "capabilities": {
          "min": 2,
          "max": 8,
          "step": 1,
          "mode": "auto"
        },
        "config_entry_id": "9d7a166b1691ec832c2d595490862d6b",
        "device_class": null,
        "device_id": "*********",
        "disabled_by": null,
        "entity_category": null,
        "entity_id": "number.midjd6_540_bf5b_target_temperature",
        "hidden_by": null,
        "icon": null,
        "id": "fd192cebacb1095eb729470caffc2479",
        "has_entity_name": false,
        "labels": [],
        "name": null,
        "options": {
          "conversation": {
            "should_expose": false
          }
        },
        "original_device_class": "temperature",
        "original_icon": "mdi:coolant-temperature",
        "original_name": "冰箱 对开门540L 冰晶岩 Refrigerating Chamber Target Temperature",
        "platform": "xiaomi_miot",
        "supported_features": 0,
        "translation_key": "fridge_chamber.target_temperature",
        "unique_id": "**:**:**:**:**:5b-fridge_chamber-3.target_temperature-2",
        "previous_unique_id": null,
        "unit_of_measurement": "°C"
      }

{
        "aliases": [],
        "area_id": null,
        "capabilities": {
          "min": -24,
          "max": -16,
          "step": 1,
          "mode": "auto"
        },
        "config_entry_id": "9d7a166b1691ec832c2d595490862d6b",
        "device_class": null,
        "device_id": "*********",
        "disabled_by": null,
        "entity_category": null,
        "entity_id": "number.midjd6_540_bf5b_target_temperature_2",
        "hidden_by": null,
        "icon": null,
        "id": "09d6f9e2d3a4f947406c48b3870836b1",
        "has_entity_name": false,
        "labels": [],
        "name": null,
        "options": {
          "conversation": {
            "should_expose": false
          }
        },
        "original_device_class": "temperature",
        "original_icon": "mdi:coolant-temperature",
        "original_name": "冰箱 对开门540L 冰晶岩 Freezing Chamber Target Temperature",
        "platform": "xiaomi_miot",
        "supported_features": 0,
        "translation_key": "fridge_chamber.target_temperature",
        "unique_id": "**:**:**:**:**:5b-fridge_chamber-4.target_temperature-2",
        "previous_unique_id": null,
        "unit_of_measurement": "°C"
      }

@al-one
Copy link
Owner Author

@al-one al-one commented on 73225c2 Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the file '.storage/core.entity_registry'. item "entity_id": "sensor.midjd6_540_bf5b_refrigerating_chamber", and "entity_id": "sensor.midjd6_540_bf5b_freezing_chamber", has the same config_entry_id and device_id.

That is normal.

Please sign in to comment.