w1ll1am23 / pyeconet

Python 3 interface to the EcoNet API
MIT License
34 stars 20 forks source link

"Unknown mode: [Electric/Gas ]" error - new generation WH or consolidation of electric/gas modes? #17

Closed rborkow closed 2 years ago

rborkow commented 2 years ago

I've been setting up the Econet integration for the first time in HA and immediately observed an error in the logs about an unknown mode:

Logger: pyeconet.equipment.water_heater
Source: /usr/lib/python3.9/site-packages/pyeconet/equipment/water_heater.py:60
First occurred: 4:15:09 PM (727 occurrences) 
Last logged: 9:14:37 PM

Unknown mode: [Electric/Gas ]

Context: My Water Heater was warranty-swapped with a new unit ~1 week ago. The old (Installed August '21) had an "electric" mode available, not "Electric/Gas." I hadn't noticed before this error, but the app does indeed have an "Electric/Gas" mode listed (with no icon) where the "Electric" mode used to live.

Has anyone else seen a similar change/error? I don't know which generation my prior model was, but this new one describes itself as heatpumpWaterHeaterGen5, which is newer than what I saw in the API response examples.

Does anyone else have a gen5 unit yet? Is anyone with gen4 or older seeing an electric/gas mode appear?

get_locations response:

{
  "results": {
    "locations": [
      {
        "@AWAY": false,
        "@AWAYCONFIG": false,
        "@LOCATION_INFO": "XXX, XXX",
        "@LOCATION_NAME": "Home",
        "@LOCATION_STATUS": "I'm Home",
        "@VACATION": false,
        "@VACATIONCONFIG": false,
        "@WEATHER": "51°",
        "@WEATHER_F": 51,
        "@WEATHER_I": "clearn.png",
        "equiptments": [
          {
            "@ACTIVE": true,
            "@ALERTCOUNT": 0,
            "@AWAY": false,
            "@AWAYCONFIG": false,
            "@AWAY_MSG": "",
            "@BCONFIG": [
              {
                "align": "center",
                "name": "@SCHEDULESTATUS",
                "type": "TEXT_LABEL_VIEW",
                "value": ""
              },
              {
                "name": "@SCHEDULERESUME",
                "title": "Resume",
                "type": "BUTTON_VIEW",
                "value": ""
              },
              {
                "align": "center",
                "type": "TEXT_LABEL_VIEW",
                "value": "Hot Water Availability"
              },
              {
                "align": "center",
                "name": "@HOTWATER",
                "title": "Hot Water Availability",
                "type": "SINGLE_IMAGE_VIEW",
                "value": "ic_tank_hundread_percent_v2.png"
              }
            ],
            "@COMBUSTION": {
              "constraints": {
                "formatDecimal": 1,
                "green": 55,
                "lowerLimit": 0,
                "orange": 25,
                "red": 20,
                "units": "HRS",
                "upperLimit": 10000000
              },
              "status": "Compressor life is normal",
              "value": 100
            },
            "@CONFIG": [
              {
                "align": "center",
                "name": "@MODECONFIG",
                "title": "This Equipment should be set to ENERGY SAVING Mode for maximum efficiency",
                "type": "IMAGE_TEXT_BUTTON_VIEW",
                "value": {
                  "constraints": {
                    "bgcolor": "#008000",
                    "enumText": [
                      "Off           ",
                      "Energy Saver  ",
                      "Heat Pump     ",
                      "High Demand   ",
                      "Electric/Gas  ",
                      "Vacation      "
                    ],
                    "enumTextIcon": [],
                    "fontcolor": "#FFFFFF",
                    "icon": "ic_energy_saver",
                    "lowerLimit": 0,
                    "upperLimit": 5
                  },
                  "status": "Enable",
                  "value": 1
                }
              }
            ],
            "@CONNECTED": true,
            "@DRACTIVE": {
              "constraints": {
                "dialog": [
                  {
                    "message": "This should not impact the water temperature in your home. Do you want to opt out for this event ?",
                    "title": "Tank temperature has been changed in response to a Utility Load Control event",
                    "value": 1
                  }
                ]
              },
              "value": ""
            },
            "@DRESOVER": {
              "constraints": {
                "enumText": ["false", "true "],
                "enumTextIcon": [],
                "lowerLimit": 0,
                "upperLimit": 1
              },
              "status": "false",
              "value": 0
            },
            "@ENABLED": {
              "constraints": {
                "enumText": ["Disabled", "Enabled "],
                "enumTextIcon": ["ic_device_off.png", "ic_enabled.png"],
                "lowerLimit": 0,
                "upperLimit": 1
              },
              "status": "Enabled ",
              "value": 1
            },
            "@HOTWATER": "ic_tank_hundread_percent_v2.png",
            "@JA13STATUS": "",
            "@LEAKINSTALLED": {
              "constraints": {
                "align": "center",
                "bgcolor": "#bec2bf",
                "enumText": ["No ", "Yes"],
                "enumTextIcon": [],
                "fontcolor": "#000000",
                "lowerLimit": 0,
                "upperLimit": 1
              },
              "status": "",
              "title": "Leak sensor not installed",
              "value": 0
            },
            "@MODE": {
              "constraints": {
                "enumText": [
                  "Off           ",
                  "Energy Saver  ",
                  "Heat Pump     ",
                  "High Demand   ",
                  "Electric/Gas  ",
                  "Vacation      "
                ],
                "enumTextIcon": [
                  "ic_device_off.png",
                  "ic_energy_saver.png",
                  "ic_heat_pump.png",
                  "ic_high_demand.png",
                  "http://heaticon.png",
                  "ic_vacation.png"
                ],
                "lowerLimit": 0,
                "upperLimit": 5
              },
              "status": "High Demand   ",
              "value": 3
            },
            "@MODECONFIG": {
              "constraints": {
                "bgcolor": "#008000",
                "enumText": [
                  "Off           ",
                  "Energy Saver  ",
                  "Heat Pump     ",
                  "High Demand   ",
                  "Electric/Gas  ",
                  "Vacation      "
                ],
                "enumTextIcon": [],
                "fontcolor": "#FFFFFF",
                "icon": "ic_energy_saver",
                "lowerLimit": 0,
                "upperLimit": 5
              },
              "status": "Enable",
              "value": 1
            },
            "@MODEIMAGE": "",
            "@NAME": {
              "constraints": {
                "stringLength": 64
              },
              "value": "Heat Pump Water Heater"
            },
            "@OVERRIDE": {
              "constraints": {
                "bgcolor": "#FFFF00",
                "fontcolor": "#000000",
                "icon": "ic_high_level_alert.png"
              },
              "status": "",
              "value": ""
            },
            "@OVERRIDESTATUS": "",
            "@RESUME": false,
            "@RUNNING": "Compressor Running",
            "@SCHEDULE": false,
            "@SCHEDULERESUME": "",
            "@SCHEDULESTATUS": "",
            "@SETPOINT": {
              "constraints": {
                "error": [],
                "formatDecimal": 0,
                "isConversion": true,
                "lowerLimit": 110,
                "units": "deg F",
                "upperLimit": 140,
                "warning": [
                  {
                    "message": "CAUTION HOT WATER. Contact may cause serious burns to skin",
                    "value": 121
                  }
                ]
              },
              "value": 120
            },
            "@STATUS": "Enabled ",
            "@TANK": {
              "constraints": {
                "green": 40,
                "orange": 30,
                "red": 30
              },
              "status": "Element operating normally",
              "value": 100
            },
            "@TCONFIG": [
              {
                "align": "center",
                "name": "@MODEIMAGE",
                "type": "SINGLE_IMAGE_VIEW",
                "value": ""
              },
              {
                "align": "center",
                "name": "@RUNNING",
                "type": "TEXT_LABEL_VIEW",
                "value": "Compressor Running"
              },
              {
                "align": "center",
                "name": "@OVERRIDESTATUS",
                "type": "TEXT_LABEL_VIEW",
                "value": ""
              }
            ],
            "@TYPE": "heatpumpWaterHeaterGen5",
            "@VACATION": false,
            "@VALVE": {
              "constraints": {
                "dialog": [
                  {
                    "message": "Closing the shut off valve will disable the water heater",
                    "title": "Closing Valve",
                    "value": 0
                  }
                ],
                "error": []
              },
              "value": ""
            },
            "@VALVESTATUS": {
              "constraints": {
                "align": "center",
                "bgcolor": "#bec2bf",
                "fontcolor": "#000000"
              },
              "status": "",
              "title": "Shut-OFF Valve not installed",
              "value": 1
            },
            "actions": [
              "waterheaterScheduleView",
              "networkSettings",
              "waterheaterUsageReportView",
              "waterheaterHealthView"
            ],
            "device_name": "",
            "device_type": "WH",
            "mac_address": "",
            "serial_number": ""
          }
        ],
        "location_id": ""
      }
    ]
  },
  "success": true,
  "logs": "",
  "stack": ""
}
w1ll1am23 commented 2 years ago

@rborkow thanks for the details. Noticed in the HA issue you mentioned you were able to "fix" it by update pyeconet. Do you mode opening a PR with the fix? If you can't I can try to get to this, but things are a little crazy for me at the moment.

rborkow commented 2 years ago

@w1ll1am23 Yes, I'll open a PR soon as I can!

powdahound commented 2 years ago

Just installed a newer water heater and was wondering why the data flowing to HA was so lossy until I saw this error in the logs. Thanks for the fix @rborkow! Would love to see this merged.

rborkow commented 2 years ago

@powdahound Merged, and bumped in HA core - Hoping the update makes it into 2022.2.9

powdahound commented 2 years ago

@rborkow Thank you! 🤞

jat255 commented 1 year ago

@rborkow, sorry for the random mention, but I appear to be having similar issues. I'm using a HPWH from Rheem, and while I'm not seeing errors from pyeconet, it appears the home assistant integration is not totally functional, as I cannot set my water heater to "Electric/Gas" mode from the HA control.

From that integration I see the following:

image

But in my econet app, I see:

image

I am using HA 2022.11.5, and it's using pyeconet 0.1.15. Any ideas on where to look to get things working? I'm pretty new to HA, so apologies if I got any terminology incorrect.

Running the example in the README, I get:

Name: Heat Pump Water Heater
Set point: 140
Supports modes: True
Operation modes: [<WaterHeaterOperationMode.OFF: 1>, <WaterHeaterOperationMode.ENERGY_SAVING: 3>, <WaterHeaterOperationMode.HEAT_PUMP_ONLY: 4>, <WaterHeaterOperationMode.HIGH_DEMAND: 5>, <WaterHeaterOperationMode.ELECTRIC_MODE: 2>, <WaterHeaterOperationMode.VACATION: 9>, <WaterHeaterOperationMode.OFF: 1>]
Operation mode: WaterHeaterOperationMode.ELECTRIC_MODE
jat255 commented 1 year ago

@rborkow @powdahound, any ideas?

powdahound commented 1 year ago

@jat255 Do these devices actually support running in resistance electric mode with the heat pump turned off? I've never tried this "Electric/Gas" option and it seems odd to me that it doesn't have an icon in the EcoNet app.

jat255 commented 1 year ago

It does; I have it in that mode currently, since we have it in a garage that gets a bit chilly in the winter months. The no icon in the app is weird, but it works when I change it to that mode (I see it switch to "Electric" on the units actual display)

powdahound commented 1 year ago

Interesting. I can check mine later today and see if it's working for me.

Would high demand mode also work? Doesn't that cause it to use the HP + resistance in tandem?

jat255 commented 1 year ago

The other modes work (Eco, Off, Heat Pump, etc.). I'm in the process of debugging, but it looks like when selecting "Electric" in home assistant, the MODE parameter is not getting set correctly. Here's what happens in set_mode() when setting to "High demand":

2022-12-19 11:43:55.204 DEBUG (SyncWorker_2) [pyeconet.equipment.water_heater] set_mode -- Inside set_mode; mode is WaterHeaterOperationMode.HIGH_DEMAND
2022-12-19 11:43:55.204 DEBUG (SyncWorker_2) [pyeconet.equipment.water_heater] set_mode -- text_modes is: ['Off ', 'Energy Saver ', 'Heat Pump ', 'High Demand ', 'Electric/Gas ', 'Vacation ']
2022-12-19 11:43:55.204 DEBUG (SyncWorker_2) [pyeconet.equipment.water_heater] set_mode -- payload is {'@ENABLED': 1, '@MODE': 3}

Here's "Eco":

2022-12-19 11:42:42.693 DEBUG (SyncWorker_4) [pyeconet.equipment.water_heater] set_mode -- Inside set_mode; mode is WaterHeaterOperationMode.ENERGY_SAVING
2022-12-19 11:42:42.693 DEBUG (SyncWorker_4) [pyeconet.equipment.water_heater] set_mode -- text_modes is: ['Off ', 'Energy Saver ', 'Heat Pump ', 'High Demand ', 'Electric/Gas ', 'Vacation ']
2022-12-19 11:42:42.693 DEBUG (SyncWorker_4) [pyeconet.equipment.water_heater] set_mode -- payload is {'@ENABLED': 1, '@MODE': 1}

And then here's "Electric" (notice there's no @MODE parameter):

2022-12-19 11:43:57.677 DEBUG (SyncWorker_0) [pyeconet.equipment.water_heater] set_mode -- Inside set_mode; mode is WaterHeaterOperationMode.ELECTRIC_MODE
2022-12-19 11:43:57.677 DEBUG (SyncWorker_0) [pyeconet.equipment.water_heater] set_mode -- text_modes is: ['Off ', 'Energy Saver ', 'Heat Pump ', 'High Demand ', 'Electric/Gas ', 'Vacation ']
2022-12-19 11:43:57.677 DEBUG (SyncWorker_0) [pyeconet.equipment.water_heater] set_mode -- payload is {'@ENABLED': 1}
jat255 commented 1 year ago

Oh, this might be the issue (and fix): https://github.com/w1ll1am23/pyeconet/commit/c55ccc387f52482f318cd784e8d8f88250259394

Looking at more debugging I added, the set_mode() code is trying to set WaterHeaterOperationMode.ELECTRIC_MODE, but my water heater reports that's not a supported mode and it should instead be WaterHeaterOperationMode.ELECTRIC_GAS. The changes in that PR appear to address that issue.

jat255 commented 1 year ago

Ok, yes, updating the code to what's in 0.1.17 appears to get it working as expected. Since I'm using a container install, I think I'll just need to wait for the next release of HA (since it appears to overwrite my changes when HA restarts), but I'm glad to see it working. Thanks @powdahound and @cpcowart!

jat255 commented 1 year ago

@vangorra or @w1ll1am23, do you know how to get this updated version of pyeconet into HA container? I thought opening an issue in HA would be the right place, but that was dismissed immediately, so I'm not sure where to request an update.

w1ll1am23 commented 1 year ago

@jat255 I just opened a PR after seeing the issue you opened. I wasn't watching things and didn't know that the author of the fix hadn't opened a change on the HA side, sorry about that.

jat255 commented 1 year ago

No worries! Thanks for bumping it just now. And thanks for the great library!