Connecting to Midea...
 
Notifications
Clear all

Connecting to Midea MSmartHome using a PC

364 Posts
13 Users
22 Reactions
47.1 K Views
cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

Posted by: @derek-m

Can you supply a list of all the sensor names that are located in the list.

Sorry, forgot to answer this. This is the current midea_devices.py list for C3 devices:

    0xC3: {
        "name": "Heat Pump Wi-Fi Controller",
        "entities": {
            "climate_zone1": {
                "type": "climate",
                "icon": "mdi:air-conditioner",
                "name": "Zone1 Thermostat",
                "zone": 0,
                "default": True
            },
            "climate_zone2": {
                "type": "climate",
                "icon": "mdi:air-conditioner",
                "name": "Zone2 Thermostat",
                "zone": 1,
                "default": True
            },
            "water-heater": {
                "type": "water_heater",
                "icon": "mdi:heat-pump",
                "name": "Domestic hot water",
                "default": True
            },
            C3Attributes.disinfect: {
                "type": "switch",
                "name": "Disinfect",
                "icon": "mdi:water-plus-outline"
            },
            C3Attributes.dhw_power: {
                "type": "switch",
                "name": "DHW Power",
                "icon": "mdi:power"
            },
            C3Attributes.fast_dhw: {
                "type": "switch",
                "name": "Fast DHW",
                "icon": "mdi:rotate-orbit"
            },
            C3Attributes.zone1_curve: {
                "type": "switch",
                "name": "Zone1 Curve",
                "icon": "mdi:chart-bell-curve-cumulative"
            },
            C3Attributes.zone2_curve: {
                "type": "switch",
                "name": "Zone2 Curve",
                "icon": "mdi:chart-bell-curve-cumulative"
            },
            C3Attributes.zone1_power: {
                "type": "switch",
                "name": "Zone1 Power",
                "icon": "mdi:power"
            },
            C3Attributes.zone2_power: {
                "type": "switch",
                "name": "Zone2 Power",
                "icon": "mdi:power"
            },
            C3Attributes.zone1_water_temp_mode: {
                "type": "binary_sensor",
                "name": "Zone1 Water-temperature Mode",
                "icon": "mdi:coolant-temperature",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.zone2_water_temp_mode: {
                "type": "binary_sensor",
                "name": "Zone2 Water-temperature Mode",
                "icon": "mdi:coolant-temperature",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.zone1_room_temp_mode: {
                "type": "binary_sensor",
                "name": "Zone1 Room-temperature Mode",
                "icon": "mdi:home-thermometer-outline",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.zone2_room_temp_mode: {
                "type": "binary_sensor",
                "name": "Zone2 Room-temperature Mode",
                "icon": "mdi:home-thermometer-outline",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.tank_actual_temperature: {
                "type": "sensor",
                "name": "Tank Actual Temperature",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.status_tbh: {
                "type": "binary_sensor",
                "name": "TBH status",
                "icon": "mdi:water-boiler",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.status_dhw: {
                "type": "binary_sensor",
                "name": "DHW status",
                "icon": "mdi:heat-pump",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.status_ibh: {
                "type": "binary_sensor",
                "name": "IBH status",
                "icon": "mdi:coolant-temperature",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.status_heating: {
                "type": "binary_sensor",
                "name": "Heating status",
                "icon": "mdi:heat-pump",
                "device_class": BinarySensorDeviceClass.RUNNING,
            },
            C3Attributes.total_energy_consumption: {
                "type": "sensor",
                "name": "Total energy consumption",
                "device_class": SensorDeviceClass.ENERGY,
                "unit": ENERGY_KILO_WATT_HOUR,
                "state_class": SensorStateClass.TOTAL_INCREASING
            },
            C3Attributes.total_produced_energy: {
                "type": "sensor",
                "name": "Total produced energy",
                "device_class": SensorDeviceClass.ENERGY,
                "unit": ENERGY_KILO_WATT_HOUR,
                "state_class": SensorStateClass.TOTAL_INCREASING
            },
            C3Attributes.byte_09: {
                "type": "sensor",
                "name": "Byte 09",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_10: {
                "type": "sensor",
                "name": "Byte 10",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_11: {
                "type": "sensor",
                "name": "Byte 11",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_12: {
                "type": "sensor",
                "name": "Byte 12",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_13: {
                "type": "sensor",
                "name": "Byte 13",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_14: {
                "type": "sensor",
                "name": "Byte 14",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_15: {
                "type": "sensor",
                "name": "Byte 15",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_16: {
                "type": "sensor",
                "name": "Byte 16",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_05_01: {
                "type": "sensor",
                "name": "Byte 05_01",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_05_02: {
                "type": "sensor",
                "name": "Byte 05_02",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_05_03: {
                "type": "sensor",
                "name": "Byte 05_03",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_05_04: {
                "type": "sensor",
                "name": "Byte 05_04",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_05_05: {
                "type": "sensor",
                "name": "Byte 05_05",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_05_06: {
                "type": "sensor",
                "name": "Byte 05_06",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
# Change Total Mystery 1 as shown below
            C3Attributes.current_temperature: { 
                "type": "sensor",
                "name": "Current Temperature",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
# Change Total Mystery 2 as shown below
            C3Attributes.target_temperature: {
                "type": "sensor",
                "name": "Target Temperature",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
             },
# Change Outdoor Temperature as shown below
             C3Attributes.entering_water_temperature: {
                "type": "sensor",
                "name": "Entering Water Temperature",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
# Add Leaving Water Temperature as shown below
             C3Attributes.leaving_water_temperature: {
                "type": "sensor",
                "name": "Leaving Water Temperature",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
        }
    },

 

 

 

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
(@derek-m)
Illustrious Member Member
Joined: 4 years ago
Posts: 4429
 

Posted by: @cathoderay

@derek-m - that's very interesting, and armed with it, I had another look in HA and it turns out the extra sensors are visible in Midea AC LAN > configure:

image

I hadn't spotted them before (was looking in the logs, not in configuration options). As you can see I have enabled them - now it is a question of waiting to see if they produce any data!

This is produced by the code in the c3/message.py and message.py files you already have plus this in midea_devices.py:

            C3Attributes.byte_05_01: {
                "type": "sensor",
                "name": "Byte 05_01",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },
            C3Attributes.byte_05_02: {
                "type": "sensor",
                "name": "Byte 05_02",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": TEMP_CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT
            },

repeated up to byte_05_06. I've just used temp settings as a proxy way of dealing with anything that turns up.

 

The list to which I referred was the 'Extra Entities' in which you had to select the ones required. Does the list just contain the ones that have been added by you, or does it contain any other sensors. Is there a further list containing all the possible sensors, in all the devices within Midea_ac_lan?

In particular, are there any temperature sensors that may be monitoring LWT and RWT? 

 


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

None of the byte_05 entities, which have been running overnight,  have collected any data, either in HA itself or in the logs.

Posted by: @derek-m

The list to which I referred was the 'Extra Entities' in which you had to select the ones required. Does the list just contain the ones that have been added by you, or does it contain any other sensors. Is there a further list containing all the possible sensors, in all the devices within Midea_ac_lan?

In particular, are there any temperature sensors that may be monitoring LWT and RWT? 

It has the very limited default sensor entities added by the original midea_ac_lan code, eg DHW tank temperature and a number of which are binary eg heating status on/off plus the ones I have added as in the code you have copies of. I think we can safely say we now know how to add entities, what we don't know is what to query, how to query it and how to process any results from the query. In a car dashboard analogy, we know how to fit gauges, but they aren't yet connected to or measuring anything.

   

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
(@derek-m)
Illustrious Member Member
Joined: 4 years ago
Posts: 4429
 

Posted by: @cathoderay

None of the byte_05 entities, which have been running overnight,  have collected any data, either in HA itself or in the logs.

Posted by: @derek-m

The list to which I referred was the 'Extra Entities' in which you had to select the ones required. Does the list just contain the ones that have been added by you, or does it contain any other sensors. Is there a further list containing all the possible sensors, in all the devices within Midea_ac_lan?

In particular, are there any temperature sensors that may be monitoring LWT and RWT? 

It has the very limited default sensor entities added by the original midea_ac_lan code, eg DHW tank temperature and a number of which are binary eg heating status on/off plus the ones I have added as in the code you have copies of. I think we can safely say we now know how to add entities, what we don't know is what to query, how to query it and how to process any results from the query. In a car dashboard analogy, we know how to fit gauges, but they aren't yet connected to or measuring anything.

   

Correct me if I am wrong, do I assume that the list of 'entities' that appear on the selection screen, contains the same devices as contained within DeviceAttributes in midea/devices/C3/device.py?

What happens if one of the devices is commented or removed from the list, is it also removed from the selection screen, or just becomes 'not selectable'? 

 


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

Posted by: @derek-m

Correct me if I am wrong, do I assume that the list of 'entities' that appear on the selection screen, contains the same devices as contained within DeviceAttributes in midea/devices/C3/device.py?

Yes and no, they are in that list, but as far as I can see the selection drop-down list contents come from the very similar list in midea_devices.py (the very long code quote above) where the "type" is either "binary_sensor" or "sensor". The ones with "type": "switch" appear under a different drop-down called 'Controls'.

Posted by: @derek-m

What happens if one of the devices is commented or removed from the list, is it also removed from the selection screen, or just becomes 'not selectable'? 

In both cases, they disappear entirely, cease to exist anywhere. They have to be commented out and removed in both midea_devices.py and c3/device.py, if there is a mismatch midea_ac_lan fails to start (fatal error). 

  

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
(@derek-m)
Illustrious Member Member
Joined: 4 years ago
Posts: 4429
 

@cathoderay

I am in the process of modifying the C3 files, but I'm uncertain about the code where the NewProtocolTags are declared in AC message, where indoor humidity = 0x0015.

For the moment I am trying to add outdoor temperature, but of course don't know what should replace the 0x0015. I suspect that it may refer to a location within a list, but of course cannot say for certain.

At that moment I will leave the value at 0x0015, which may cause a problem when the code is run. If you find anything relating to this issue in the meantime, then please let me know.


   
ReplyQuote



cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

Posted by: @derek-m

At that moment I will leave the value at 0x0015, which may cause a problem when the code is run. If you find anything relating to this issue in the meantime, then please let me know.

Just a thought - a c3 device ie a heat pump doesn't know about indoor humidity, so it can't put humidity data in the message. If any data does appear, it must be something else.

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
(@derek-m)
Illustrious Member Member
Joined: 4 years ago
Posts: 4429
 

@cathoderay

I have made some changes around the 'class MessageSet (MessageC3Base)' code within C3 message.py, as detailed in the attached text document.

Please give it a try and see if anything useful occurs. I have just realised that you will have to remove the commenting for 'outdoor temperature' and comment all the 'byte' code, otherwise there may be fighting for the same message space. 

 


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

@derek-m - I'll try running it as is, if it crashes I'll uncomment/comment it as you suggest.

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

@derek-m - there were some tab/indent errors, which crashed it, which I corrected and it ran, but nothing showing up for outdoor_temperature as it needs corresponding lines in midea_devices.py and c3/device.py which I have now added. I have got the first few logged Status update entries and they show:

Status update: {'zone1_power': True, 'zone2_power': False, 'dhw_power': False, 'disinfect': False, 'fast_dhw': False, 'zone_temp_type': [True, True], 'mode': 3, 'mode_auto': 3, 'zone_target_temp': [40, 30], 'dhw_target_temp': 50, 'room_target_temp': 24.0, 'zone_heating_temp_max': [65, 55], 'zone_heating_temp_min': [35, 25], 'zone_cooling_temp_max': [25, 25], 'zone_cooling_temp_min': [5, 5], 'room_temp_max': 30.0, 'room_temp_min': 17.0, 'dhw_temp_max': 60, 'dhw_temp_min': 20, 'tank_actual_temperature': 39, 'outdoor_temperature': 0, 'zone1_water_temp_mode': True, 'zone2_water_temp_mode': False, 'zone1_room_temp_mode': False, 'zone2_room_temp_mode': False}

 

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
(@derek-m)
Illustrious Member Member
Joined: 4 years ago
Posts: 4429
 

Posted by: @cathoderay

@derek-m - there were some tab/indent errors, which crashed it, which I corrected and it ran, but nothing showing up for outdoor_temperature as it needs corresponding lines in midea_devices.py and c3/device.py which I have now added. I have got the first few logged Status update entries and they show:

Status update: {'zone1_power': True, 'zone2_power': False, 'dhw_power': False, 'disinfect': False, 'fast_dhw': False, 'zone_temp_type': [True, True], 'mode': 3, 'mode_auto': 3, 'zone_target_temp': [40, 30], 'dhw_target_temp': 50, 'room_target_temp': 24.0, 'zone_heating_temp_max': [65, 55], 'zone_heating_temp_min': [35, 25], 'zone_cooling_temp_max': [25, 25], 'zone_cooling_temp_min': [5, 5], 'room_temp_max': 30.0, 'room_temp_min': 17.0, 'dhw_temp_max': 60, 'dhw_temp_min': 20, 'tank_actual_temperature': 39, 'outdoor_temperature': 0, 'zone1_water_temp_mode': True, 'zone2_water_temp_mode': False, 'zone1_room_temp_mode': False, 'zone2_room_temp_mode': False}

 

Maybe try adding Byte23, Byte24 and Byte25 in the same manner as outdoor_temperature.

So it is possible to add devices to the type 01 message, but they may just return '0' i.e. no data. What is unclear is if there is a limit to the number of values that can be placed in the type 01 message, or that the wrong data is being requested. The other factor that is unclear is if the available data appears in a fixed place within the message.

A further test would be to remove 'tank_actual_temperature' from the list and see if the data obtained is actually the tank temperature, but under the name outdoor_temperature.

 


   
ReplyQuote
(@derek-m)
Illustrious Member Member
Joined: 4 years ago
Posts: 4429
 

@cathoderay

A further test would be to move one of the energy devices to position 23, 24, 25 and 26 in the message body and see if it appears in the type 01 message.


   
ReplyQuote



Page 28 / 31



Share:

Join Us!

Trusted Installers

Struggling to find a reliable heat pump installer? A poor installation can lead to inefficiencies and high running costs. We now connect homeowners with top-rated installers who deliver quality work and excellent service.

✅ Verified, trusted & experienced installers
✅ Nationwide coverage expanding
✅ Special offers available

👉 Find your installer now!

Latest Posts

x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security