SonoffLAN icon indicating copy to clipboard operation
SonoffLAN copied to clipboard

NS Panel Climate Control

Open proxlx opened this issue 2 years ago • 3 comments

Hello! I have recently added an NS Panel to my system. I have noticed that the climate controls seem to only work correctly one way. NS Panel —-> HA. Every change made on the NS panel thermostat (temp, hvac mode) appears correctly in HA (and instantaneous) but if I set a temperature in HA it doesn’t then appear in the Panel. All HVAC mode works correctly from HA but not target temperature. Any adjustments made in HA just jump back to what is currently set on the NS Panel.

Sonoff For LAN latest version NS Panel Firmware 1.3.1

Many thanks!

proxlx avatar Sep 18 '22 17:09 proxlx

Show device diagnostics.

AlexxIT avatar Sep 24 '22 09:09 AlexxIT

Hi AlexxIT - Thank you for looking at this. Please see below:-

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.9.5",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "5.15.67",
    "supervisor": "2022.09.1",
    "host_os": "Home Assistant OS 9.0",
    "docker_version": "20.10.17",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "iphonedetect": {
      "version": "1.4.0",
      "requirements": []
    },
    "shelly": {
      "version": "1.0.2",
      "requirements": [
        "pyShelly==1.0.2",
        "paho-mqtt==1.6.1",
        "websocket-client"
      ]
    },
    "hive": {
      "version": "2021.7.0",
      "requirements": [
        "pyhiveapi==0.5.13"
      ]
    },
    "hildebrandglow_dcc": {
      "version": "0.6.0",
      "requirements": []
    },
    "jlrincontrol": {
      "version": "2.2.0",
      "requirements": [
        "jlrpy==1.4.1"
      ]
    },
    "alexa_media": {
      "version": "4.1.2",
      "requirements": [
        "alexapy==1.26.3",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "sonoff": {
      "version": "3.2.0",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "hacs": {
      "version": "1.27.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    }
  },
  "integration_manifest": {
    "domain": "sonoff",
    "name": "Sonoff",
    "config_flow": true,
    "documentation": "https://github.com/AlexxIT/SonoffLAN",
    "issue_tracker": "https://github.com/AlexxIT/SonoffLAN/issues",
    "codeowners": [
      "@AlexxIT"
    ],
    "dependencies": [
      "http",
      "zeroconf"
    ],
    "requirements": [
      "pycryptodome>=3.6.6"
    ],
    "version": "3.2.0",
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "version": "38856d1",
    "cloud_auth": true,
    "config": {
      "username": "***",
      "password": "***",
      "reload": "always"
    },
    "options": {},
    "errors": [
      {
        "name": "custom_components.sonoff.core.ewelink.cloud",
        "message": [
          "Cloud processing error"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/cloud.py",
          63
        ],
        "timestamp": 1663922800.3581834,
        "exception": "Traceback (most recent call last):\n  File \"/config/custom_components/sonoff/core/ewelink/cloud.py\", line 286, in run_forever\n    await self._process_ws_msg(resp)\n  File \"/config/custom_components/sonoff/core/ewelink/cloud.py\", line 333, in _process_ws_msg\n    self._set_response(data[\"sequence\"], data[\"error\"])\n  File \"/config/custom_components/sonoff/core/ewelink/cloud.py\", line 63, in _set_response\n    self._waiters[sequence].set_result(result)\nasyncio.exceptions.InvalidStateError: invalid state\n",
        "count": 1,
        "first_occurred": 1663922800.3581834
      },
      {
        "name": "custom_components.sonoff.core.ewelink.cloud",
        "message": [
          "Cloud ERROR: {'error': 504, 'reason': 'Request Timeout', 'deviceid': '1000be61bb', 'apikey': '641e5131-b912-4992-a5f5-2ab76f753df7', 'sequence': '1663925451407'}",
          "Cloud ERROR: {'error': 400, 'deviceid': '100162f9b4', 'apikey': '641e5131-b912-4992-a5f5-2ab76f753df7', 'sequence': '1663926305000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': '100162f9b4', 'apikey': '641e5131-b912-4992-a5f5-2ab76f753df7', 'sequence': '1663928405000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': '100162f9b4', 'apikey': '641e5131-b912-4992-a5f5-2ab76f753df7', 'sequence': '1663956005000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': '100162f9b4', 'apikey': '641e5131-b912-4992-a5f5-2ab76f753df7', 'sequence': '1664002805000'}"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/cloud.py",
          286
        ],
        "timestamp": 1664002805.2928436,
        "exception": "",
        "count": 16,
        "first_occurred": 1663869605.385194
      },
      {
        "name": "custom_components.sonoff.core.ewelink.cloud",
        "message": [
          "Cloud processing error"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/__init__.py",
          159
        ],
        "timestamp": 1664004089.3960657,
        "exception": "Traceback (most recent call last):\n  File \"/config/custom_components/sonoff/core/ewelink/cloud.py\", line 286, in run_forever\n    await self._process_ws_msg(resp)\n  File \"/config/custom_components/sonoff/core/ewelink/cloud.py\", line 340, in _process_ws_msg\n    self.dispatcher_send(SIGNAL_UPDATE, data)\n  File \"/config/custom_components/sonoff/core/ewelink/base.py\", line 59, in dispatcher_send\n    handler(*args, **kwargs)\n  File \"/config/custom_components/sonoff/core/ewelink/__init__.py\", line 159, in cloud_update\n    did = msg[\"deviceid\"]\nKeyError: 'deviceid'\n",
        "count": 1,
        "first_occurred": 1664004089.3960657
      }
    ],
    "device": {
      "uiid": 133,
      "params": {
        "bindInfos": "***",
        "version": 8,
        "pulses": [
          {
            "pulse": "off",
            "width": 1000,
            "outlet": 0
          },
          {
            "pulse": "off",
            "width": 1000,
            "outlet": 1
          }
        ],
        "switches": [
          {
            "switch": "off",
            "outlet": 0
          },
          {
            "switch": "off",
            "outlet": 1
          }
        ],
        "configure": [
          {
            "startup": "off",
            "outlet": 0
          },
          {
            "startup": "off",
            "outlet": 1
          }
        ],
        "lock": 0,
        "fwVersion": "1.3.1",
        "reset_reason": "ESP_RST_POWERON",
        "value": 1,
        "temperature": 20,
        "humidity": "blank",
        "tempUnit": 0,
        "HMI_outdoorTemp": {
          "current": 16,
          "range": "9,16"
        },
        "HMI_weather": 35,
        "cityId": "2292429",
        "dst": 1,
        "dstChange": "2022-10-30T01:00:00.000Z",
        "geo": "52.77263588574351,-4.102939805457597",
        "timeZone": 0,
        "cityStr": "Barmouth",
        "only_device": {
          "ota": "success",
          "ota_fail_reason": 0
        },
        "ctype": "device",
        "id": "1000be61bb",
        "resourcetype": "ATC",
        "HMI_ATCDevice": {
          "ctype": "device",
          "id": "1000be61bb",
          "outlet": 0,
          "etype": "hot",
          "precision": 1
        },
        "ATCEnable": 0,
        "ATCMode": 0,
        "ATCExpect0": 22,
        "HMI_resources": [
          {
            "ctype": "scene",
            "id": "632b746866f88d09f34350db"
          },
          {
            "ctype": "scene",
            "id": "632b749366f88d09f34350df"
          },
          {
            "ctype": "scene",
            "id": "632c54b98b5c16663e1bfb73"
          },
          {
            "ctype": "scene",
            "id": "632b7543ff70f460c0bdf532"
          },
          {
            "ctype": "scene",
            "id": "632b7501ff70f460c0bdf52f"
          },
          {
            "ctype": "scene",
            "id": "632b74da66f88d09f34350e5"
          },
          {
            "ctype": "scene",
            "id": "632b5d8c8b5c16663e1bf08d"
          },
          {
            "ctype": "scene",
            "id": "632b5e2166f88d09f3434e61"
          }
        ],
        "tempCorrection": 1
      },
      "model": "NSPanel",
      "online": true,
      "localtype": null,
      "deviceid": "100162f9b4"
    }
  }
}

proxlx avatar Sep 24 '22 09:09 proxlx

https://user-images.githubusercontent.com/64808492/192092499-74dfb1be-6e97-41d2-adc4-1c1f7b5e6f95.mov

Please see short clip showing the NS Panel talking correctly to HA, but HA not sending the temp to the NS Panel. HVAC mode from HA to NS Panel works correctly. Many thanks

proxlx avatar Sep 24 '22 10:09 proxlx

I have the same problem !

MishoOo123 avatar Oct 01 '22 19:10 MishoOo123

Here too, but I think this is a bug in Sonoff, looks like the NSPanel is stronger than the cloud command. I try it with other parameters than "ATCExpect0", maybe we can refresh the screen, but failed (ex. HMI_ATCDevice reconfiguration).

No difference between 1.3.0 and 1.3.1 panel FW.

Test: If you don't wake up the panel, and only use the eWelink app, the climate control is "sometimes random" working.

sipimokus avatar Oct 05 '22 09:10 sipimokus

@sipimokus @MishoOo123 Did anybody manage to find a work around for this issue at all? Many thanks!

proxlx avatar Oct 22 '22 16:10 proxlx

Maybe I found working method, but not perfect, looks like my HASS don't managing perfectly the cooling / heating mode. 🤔

PR: https://github.com/AlexxIT/SonoffLAN/pull/1014


@MishoOo123 @proxlx I use all NSPanel in heating mode, so the error does not occur.

Check it please, you can testing locally, ex. override /config/custom_components/sonoff/climate.py file with this: https://raw.githubusercontent.com/AlexxIT/SonoffLAN/9d2d2e70655ddc21671fdbf62a1cdd40feb271d5/custom_components/sonoff/climate.py

sipimokus avatar Oct 25 '22 16:10 sipimokus

@sipimokus Thank you for investigating and sharing the code! I have tried the new climate.py but I seem to lose the temperature control itself. It shows the current temperature reported from the NS Panel but not the target temperature. See both screen shots with Original Climate File & You're New Climate File. It reports cannot call service if you try to move the temperature slider.

I replaced climate.py and then restarted HA, I think that is correct and didn't need to do anything more?

Many thanks!

Original Climate PY Updated Climate PY

proxlx avatar Oct 25 '22 17:10 proxlx

@sipimokus Many thanks! Finally is Work. great job !

MishoOo123 avatar Oct 25 '22 21:10 MishoOo123

@sipimokus This was my mistake! I was one version behind latest when I changed the file yesterday. I updated to latest Sonoff LAN and then changed the climate.py file and it works perfectly!! Thank you!

proxlx avatar Oct 26 '22 09:10 proxlx

Hi! Regarding the fix, it resolves the problem of HA->NSPanel control, but if you choose one of the NSPanel's channels as an executing device, it turns on/off physically and in HA, but in ewelink it doesn't update the current state of the channel. Just as a remark with hope to be fixed in 3.4.0.

Opontios avatar Nov 18 '22 11:11 Opontios

I'm trying to get something like this to work, how did you get the thermostat from HA to show up as a widget in the NSPanel?

BorjaLL avatar Mar 14 '23 19:03 BorjaLL

@BorjaLL The NS Panel is just standard so it runs as it normally would out of the box. All the images / videos on this topic is taken from HA

proxlx avatar Mar 15 '23 14:03 proxlx

https://github.com/AlexxIT/SonoffLAN/releases/tag/v3.5.1

AlexxIT avatar Mar 31 '23 11:03 AlexxIT