AlexxIT / SonoffLAN

Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
https://github.com/AlexxIT/Blog
MIT License
2.73k stars 415 forks source link

SPM-4Relay: Can't decrypt message #946

Closed mnuxx closed 1 year ago

mnuxx commented 2 years ago

image It shows that channel 1 and 2 are okay, but 3 and 4 are in wrong class, it seems I have 1 main and 4 relay modules. It looks that every module have same. 1&2 okay

AlexxIT commented 2 years ago

You need to download and show device diagnostics.

ocigam69 commented 2 years ago

Hello, I have the same problem. And also no new data appears in HA after eWelink app is closed.

AlexxIT, if you need more help, comment. Sorry, but this device cannot be shared.

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.9.2",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Madrid",
    "os_name": "Linux",
    "os_version": "5.15.60",
    "supervisor": "2022.08.6",
    "host_os": "Home Assistant OS 8.5",
    "docker_version": "20.10.14",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "climate_ip": {
      "version": "3.5.2",
      "requirements": [
        "requests>=2.21.0",
        "xmljson>=0.2.0"
      ]
    },
    "hacs": {
      "version": "1.27.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "formulaone_api": {
      "version": "0.1.5",
      "requirements": [
        "requests >=2.20"
      ]
    },
    "edge_tts": {
      "version": "0.0.1",
      "requirements": [
        "edge-tts==5.0.1"
      ]
    },
    "sonoff": {
      "version": "3.2.0",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "alexa_media": {
      "version": "4.1.2",
      "requirements": [
        "alexapy==1.26.3",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "alarmo": {
      "version": "v1.9.5",
      "requirements": []
    }
  },
  "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": "1b3db6f",
    "cloud_auth": true,
    "config": null,
    "options": {
      "mode": "auto",
      "debug": false,
      "homes": 1
    },
    "errors": [
      {
        "name": "custom_components.sonoff.core.ewelink.local",
        "message": [
          "100173850d => Local4 | {'switches': [{'outlet': 0, 'switch': 'off'}]} <= {'sequence': '166X090065000', 'seq': 57, 'error': 400, 'encrypt': True}",
          "100173850d => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '166X3090075000', 'seq': 61, 'error': 400, 'encrypt': True}",
          "100173850d => Local4 | {'switches': [{'outlet': 0, 'switch': 'off'}]} <= {'sequence': '166X090108000', 'seq': 64, 'error': 400, 'encrypt': True}",
          "100173850d => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '166X090114000', 'seq': 68, 'error': 400, 'encrypt': True}",
          "100173850d => Local4 | {'switches': [{'outlet': 0, 'switch': 'off'}]} <= {'sequence': '166X090124000', 'seq': 71, 'error': 400, 'encrypt': True}"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/local.py",
          255
        ],
        "timestamp": 1663090125.0121412,
        "exception": "",
        "count": 15,
        "first_occurred": 1663015031.2881017
      },
      {
        "name": "custom_components.sonoff.core.ewelink.cloud",
        "message": [
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-XXXXXXXXXXXX', 'sequence': '166X083519000'}",
          "Cloud ERROR: {'error': 504, 'reason': 'Request Timeout', 'deviceid': '100173850d', 'apikey': 'acb441d7-1b57-48d8-8fd5-XXXXXXXXXXXX', 'sequence': '166X086962000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-XXXXXXXXXXXX', 'sequence': '166X087119000'}",
          "Cloud ERROR: {'error': 504, 'reason': 'Request Timeout', 'deviceid': '100173850d', 'apikey': 'acb441d7-1b57-48d8-8fd5-XXXXXXXXXXXX', 'sequence': '166X090562000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-XXXXXXXXXXXX', 'sequence': '166X090720000'}"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/cloud.py",
          286
        ],
        "timestamp": 1663090720.3333123,
        "exception": "",
        "count": 46,
        "first_occurred": 1663014965.9067159
      }
    ],
    "device": {
      "uiid": 130,
      "params": {
        "bindInfos": "***",
        "subDevId": "132e464e36353613353XXXXX",
        "parentid": "10015661df",
        "configure": [
          {
            "outlet": 0,
            "startup": "stay"
          },
          {
            "outlet": 1,
            "startup": "stay"
          },
          {
            "outlet": 2,
            "startup": "stay"
          },
          {
            "outlet": 3,
            "startup": "stay"
          }
        ],
        "fwVersion": "1.2.0",
        "overload_00": {
          "delayTime": 10,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_01": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_02": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_03": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "switches": [
          {
            "outlet": 0,
            "switch": "off"
          },
          {
            "outlet": 1,
            "switch": "off"
          },
          {
            "outlet": 2,
            "switch": "off"
          },
          {
            "outlet": 3,
            "switch": "off"
          }
        ],
        "threshold": {
          "actPow": {
            "min": 10,
            "max": 480000
          },
          "current": {
            "min": 10,
            "max": 2000
          },
          "voltage": {
            "min": 9000,
            "max": 26400
          }
        },
        "timers": "***",
        "getKwh_00": 2,
        "getKwh_01": 2,
        "getKwh_02": 2,
        "getKwh_03": 2,
        "demNextFetchTime": 1663020000000,
        "faultState": {
          "cse7761Com": [
            1,
            1,
            1,
            1
          ],
          "subDevCom": 1
        },
        "uiActive": {
          "outlet": 1,
          "time": 60
        },
        "actPow_00": 0,
        "apparentPow_00": 0,
        "current_00": 0,
        "reactPow_00": 0,
        "voltage_00": 0,
        "actPow_01": 0,
        "apparentPow_01": 0,
        "current_01": 0,
        "reactPow_01": 0,
        "voltage_01": 0,
        "rangeEnd": 29,
        "rangeStart": 0
      },
      "model": "GD32-SM4(130)",
      "online": true,
      "localtype": null,
      "deviceid": "ab300001fe"
    }
  }
}
ocigam69 commented 2 years ago

Hello AlexxIT, new diagnostic with version 3.3.

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.9.6",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Madrid",
    "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": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "climate_ip": {
      "version": "3.5.2",
      "requirements": [
        "requests>=2.21.0",
        "xmljson>=0.2.0"
      ]
    },
    "hacs": {
      "version": "1.27.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "formulaone_api": {
      "version": "0.1.5",
      "requirements": [
        "requests >=2.20"
      ]
    },
    "edge_tts": {
      "version": "0.0.1",
      "requirements": [
        "edge-tts==5.0.1"
      ]
    },
    "sonoff": {
      "version": "3.3.0",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "alexa_media": {
      "version": "4.1.2",
      "requirements": [
        "alexapy==1.26.3",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "alarmo": {
      "version": "v1.9.5",
      "requirements": []
    }
  },
  "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.3.0",
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "version": "3053bf7",
    "cloud_auth": true,
    "config": null,
    "options": {
      "mode": "auto",
      "debug": false,
      "homes": 1
    },
    "errors": [
      {
        "name": "custom_components.sonoff.core.ewelink.local",
        "message": [
          "100173850d => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]}",
          "100173850d => Local4 | {'switches': [{'outlet': 0, 'switch': 'off'}]}",
          "100173850d => Local4 | {'cmd': 'info'}"
        ],
        "level": "ERROR",
        "source": [
          "custom_components/sonoff/core/ewelink/local.py",
          257
        ],
        "timestamp": 1664100044.6303153,
        "exception": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.10/site-packages/yarl/_url.py\", line 170, in __new__\n    port = val.port\n  File \"/usr/local/lib/python3.10/urllib/parse.py\", line 178, in port\n    raise ValueError(message) from None\nValueError: Port could not be cast to integer value as ':c6de:e2ff:fe0f:1ed0:8081'\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.10/site-packages/aiohttp/client.py\", line 422, in _request\n    url = self._build_url(str_or_url)\n  File \"/usr/local/lib/python3.10/site-packages/aiohttp/client.py\", line 356, in _build_url\n    url = URL(str_or_url)\n  File \"/usr/local/lib/python3.10/site-packages/yarl/_url.py\", line 172, in __new__\n    raise ValueError(\nValueError: Invalid URL: port can't be converted to integer\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"/config/custom_components/sonoff/core/ewelink/local.py\", line 257, in send\n    r = await self.session.post(\n  File \"/usr/local/lib/python3.10/site-packages/aiohttp/client.py\", line 424, in _request\n    raise InvalidURL(str_or_url) from e\naiohttp.client_exceptions.InvalidURL: http://fe80::c6de:e2ff:fe0f:1ed0:8081/zeroconf/switches\n",
        "count": 6,
        "first_occurred": 1664094353.9317856
      },
      {
        "name": "custom_components.sonoff.core.ewelink.cloud",
        "message": [
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5', 'sequence': '1664108151000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5', 'sequence': '1664111751000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5', 'sequence': '1664115352000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5', 'sequence': '1664118952000'}",
          "Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5', 'sequence': '1664122553000'}"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/cloud.py",
          286
        ],
        "timestamp": 1664122553.6402986,
        "exception": "",
        "count": 11,
        "first_occurred": 1664093749.2781081
      }
    ],
    "device": {
      "uiid": 130,
      "params": {
        "bindInfos": "***",
        "subDevId": "132e464e3635361335363238",
        "parentid": "10015661df",
        "configure": [
          {
            "outlet": 0,
            "startup": "stay"
          },
          {
            "outlet": 1,
            "startup": "stay"
          },
          {
            "outlet": 2,
            "startup": "stay"
          },
          {
            "outlet": 3,
            "startup": "stay"
          }
        ],
        "fwVersion": "1.2.0",
        "overload_00": {
          "delayTime": 10,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_01": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_02": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_03": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "switches": [
          {
            "outlet": 0,
            "switch": "off"
          },
          {
            "outlet": 1,
            "switch": "off"
          },
          {
            "outlet": 2,
            "switch": "off"
          },
          {
            "outlet": 3,
            "switch": "off"
          }
        ],
        "threshold": {
          "actPow": {
            "min": 10,
            "max": 480000
          },
          "current": {
            "min": 10,
            "max": 2000
          },
          "voltage": {
            "min": 9000,
            "max": 26400
          }
        },
        "timers": "***",
        "getKwh_00": 2,
        "getKwh_01": 2,
        "getKwh_02": 2,
        "getKwh_03": 2,
        "demNextFetchTime": 1664056800000,
        "faultState": {
          "cse7761Com": [
            1,
            1,
            1,
            1
          ],
          "subDevCom": 1
        },
        "uiActive": {
          "outlet": 3,
          "time": 60
        },
        "actPow_00": 0,
        "apparentPow_00": 0,
        "current_00": 0,
        "reactPow_00": 0,
        "voltage_00": 0,
        "actPow_01": 0,
        "apparentPow_01": 0,
        "current_01": 0,
        "reactPow_01": 0,
        "voltage_01": 0,
        "rangeEnd": 29,
        "rangeStart": 0,
        "actPow_02": 0,
        "apparentPow_02": 0,
        "current_02": 0,
        "reactPow_02": 0,
        "voltage_02": 0,
        "actPow_03": 0,
        "apparentPow_03": 0,
        "current_03": 0,
        "reactPow_03": 0,
        "voltage_03": 0
      },
      "model": "GD32-SM4(130)",
      "online": true,
      "localtype": null,
      "deviceid": "ab300001fe"
    }
  }
}
AlexxIT commented 2 years ago

Just added a fix to the master version

ocigam69 commented 2 years ago

Thanks AlexxIT, now icons is correct, but no new data appears in HA after eWelink app is closed.

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.9.6",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Madrid",
    "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": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "climate_ip": {
      "version": "3.5.2",
      "requirements": [
        "requests>=2.21.0",
        "xmljson>=0.2.0"
      ]
    },
    "hacs": {
      "version": "1.27.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "formulaone_api": {
      "version": "0.1.5",
      "requirements": [
        "requests >=2.20"
      ]
    },
    "edge_tts": {
      "version": "0.0.1",
      "requirements": [
        "edge-tts==5.0.1"
      ]
    },
    "sonoff": {
      "version": "3.3.0",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "alexa_media": {
      "version": "4.1.2",
      "requirements": [
        "alexapy==1.26.3",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "alarmo": {
      "version": "v1.9.5",
      "requirements": []
    }
  },
  "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.3.0",
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "version": "4b1005f",
    "cloud_auth": true,
    "config": null,
    "options": {
      "mode": "auto",
      "debug": false,
      "homes": 1
    },
    "errors": [
      {
        "name": "custom_components.sonoff.core.ewelink.cloud",
        "message": [
          "UNKNOWN cloud msg: {'action': 'subDevice', 'deviceid': '10015661df', 'apikey': 'acb441d7-1b57-48d8-8fd5-', 'userAgent': 'device', 'd_seq': 46624, 'params': {'cmds': [{'type': 1, 'subDevId': '132e464e3635361335363238', 'uiid': '130', 'deviceid': 'ab300001fe'}]}}",
          "UNKNOWN cloud msg: {'action': 'subDevice', 'deviceid': '10015661df', 'apikey': 'acb441d7-1b57-48d8-8fd5-', 'userAgent': 'device', 'd_seq': 36222, 'params': {'cmds': [{'type': 0, 'subDevId': '132e464e3635361335363238', 'uiid': '130', 'deviceid': 'ab300001fe'}]}}"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/cloud.py",
          286
        ],
        "timestamp": 1664132801.997475,
        "exception": "",
        "count": 2,
        "first_occurred": 1664132725.9329274
      }
    ],
    "device": {
      "uiid": 130,
      "params": {
        "bindInfos": "***",
        "subDevId": "132e464e3635361335363238",
        "parentid": "10015661df",
        "configure": [
          {
            "outlet": 0,
            "startup": "stay"
          },
          {
            "outlet": 1,
            "startup": "stay"
          },
          {
            "outlet": 2,
            "startup": "stay"
          },
          {
            "outlet": 3,
            "startup": "stay"
          }
        ],
        "fwVersion": "1.2.0",
        "overload_00": {
          "delayTime": 10,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_01": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_02": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "overload_03": {
          "delayTime": 0,
          "maxAP": {
            "en": 0,
            "val": 480000
          },
          "maxC": {
            "en": 0,
            "val": 2000
          },
          "maxV": {
            "en": 0,
            "val": 26400
          },
          "minAP": {
            "en": 0,
            "val": 10
          },
          "minV": {
            "en": 0,
            "val": 9000
          }
        },
        "switches": [
          {
            "switch": "off",
            "outlet": 0
          },
          {
            "switch": "off",
            "outlet": 1
          },
          {
            "switch": "off",
            "outlet": 2
          },
          {
            "outlet": 3,
            "switch": "off"
          }
        ],
        "threshold": {
          "actPow": {
            "min": 10,
            "max": 480000
          },
          "current": {
            "min": 10,
            "max": 2000
          },
          "voltage": {
            "min": 9000,
            "max": 26400
          }
        },
        "timers": "***",
        "getKwh_00": 2,
        "getKwh_01": 2,
        "getKwh_02": 2,
        "getKwh_03": 2,
        "demNextFetchTime": 1664056800000,
        "faultState": {
          "cse7761Com": [
            1,
            1,
            1,
            1
          ],
          "subDevCom": 1
        },
        "uiActive": {
          "outlet": 3,
          "time": 60
        },
        "actPow_00": 0,
        "apparentPow_00": 0,
        "current_00": 0,
        "reactPow_00": 0,
        "voltage_00": 0,
        "actPow_01": 0,
        "apparentPow_01": 0,
        "current_01": 0,
        "reactPow_01": 0,
        "voltage_01": 0,
        "rangeEnd": 29,
        "rangeStart": 0,
        "actPow_02": 0,
        "apparentPow_02": 0,
        "current_02": 0,
        "reactPow_02": 0,
        "voltage_02": 0,
        "actPow_03": 0,
        "apparentPow_03": 0,
        "current_03": 0,
        "reactPow_03": 0,
        "voltage_03": 0
      },
      "model": "GD32-SM4(130)",
      "online": true,
      "localtype": null,
      "deviceid": "ab300001fe"
    }
  }
AlexxIT commented 2 years ago

Because you break the update every time you open a mobile application. Component sends update command every hour. When you open mobile app - it breaks update process to the next update command.

ocigam69 commented 2 years ago

Thank you! But I don't opened the "ewelink" app for over an hour and it won't update.

ocigam69 commented 2 years ago

Sorry AlexxIT, now show correct icon, but not show unit, Wattios, voltage.... only kwh

Screenshot_20220926-132802

AlexxIT commented 2 years ago

You can follow the debug logs for two hours. And check if you can see uiActive word there (this is update command).

AlexxIT commented 2 years ago

Unit of measurements fixed in latest master version

ocigam69 commented 2 years ago

Unit of measurements fixed in latest master version

Yeahh. Now is correct!

Screenshot_20220926-153058

ocigam69 commented 2 years ago

You can follow the debug logs for two hours. And check if you can see uiActive word there (this is update command).

I try.

ocigam69 commented 2 years ago

Hello AlexxIT. The firts results (starting) (device: ab300001fe )

2022-09-26 16:16:07.218 INFO (MainThread) [homeassistant.setup] Setting up sonoff
2022-09-26 16:16:07.219 INFO (MainThread) [homeassistant.setup] Setup of domain sonoff took 0.0 seconds
2022-09-26 16:16:10.214 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe UIID 0130 | {'bindInfos': {'gaction': ['acb441d7-1b57-48d8-8fd5-41d3b0d94f2b_ewelink-google-home-v1'], 'alexa': ['acb441d7-1b57-48d8-8fd5-41d3b0d94f2b_26ca1996a20e8bd63617ab272d4eeede1d2d8e32'], 'smartThings': []}, 'subDevId': '132e464e3635361335363238', 'parentid': '10015661df', 'configure': [{'outlet': 0, 'startup': 'stay'}, {'outlet': 1, 'startup': 'stay'}, {'outlet': 2, 'startup': 'stay'}, {'outlet': 3, 'startup': 'stay'}], 'fwVersion': '1.2.0', 'overload_00': {'delayTime': 10, 'maxAP': {'en': 0, 'val': 480000}, 'maxC': {'en': 0, 'val': 2000}, 'maxV': {'en': 0, 'val': 26400}, 'minAP': {'en': 0, 'val': 10}, 'minV': {'en': 0, 'val': 9000}}, 'overload_01': {'delayTime': 0, 'maxAP': {'en': 0, 'val': 480000}, 'maxC': {'en': 0, 'val': 2000}, 'maxV': {'en': 0, 'val': 26400}, 'minAP': {'en': 0, 'val': 10}, 'minV': {'en': 0, 'val': 9000}}, 'overload_02': {'delayTime': 0, 'maxAP': {'en': 0, 'val': 480000}, 'maxC': {'en': 0, 'val': 2000}, 'maxV': {'en': 0, 'val': 26400}, 'minAP': {'en': 0, 'val': 10}, 'minV': {'en': 0, 'val': 9000}}, 'overload_03': {'delayTime': 0, 'maxAP': {'en': 0, 'val': 480000}, 'maxC': {'en': 0, 'val': 2000}, 'maxV': {'en': 0, 'val': 26400}, 'minAP': {'en': 0, 'val': 10}, 'minV': {'en': 0, 'val': 9000}}, 'switches': [{'outlet': 0, 'switch': 'on'}, {'outlet': 1, 'switch': 'on'}, {'switch': 'off', 'outlet': 2}, {'outlet': 3, 'switch': 'off'}], 'threshold': {'actPow': {'min': 10, 'max': 480000}, 'current': {'min': 10, 'max': 2000}, 'voltage': {'min': 9000, 'max': 26400}}, 'timers': [], 'getKwh_00': 2, 'getKwh_01': 2, 'getKwh_02': 2, 'getKwh_03': 2, 'demNextFetchTime': 1664143200000, 'faultState': {'cse7761Com': [1, 1, 1, 1], 'subDevCom': 1}, '**uiActive**': {'outlet': 3, 'time': 60}, 'actPow_00': 0, 'apparentPow_00': 0, 'current_00': 0, 'reactPow_00': 0, 'voltage_00': 0, 'actPow_01': 0, 'apparentPow_01': 0, 'current_01': 0, 'reactPow_01': 0, 'voltage_01': 0, 'rangeEnd': 29, 'rangeStart': 0, 'actPow_02': 0, 'apparentPow_02': 0, 'current_02': 0, 'reactPow_02': 0, 'voltage_02': 0, 'actPow_03': 0, 'apparentPow_03': 0, 'current_03': 0, 'reactPow_03': 0, 'voltage_03': 0}

2022-09-26 16:16:10.219 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10015661df UIID 0128 | {'bindInfos': {'gaction': ['acb441d7-1b57-48d8-8fd5-41d3b0d94f2b_ewelink-google-home-v1'], 'alexa': ['acb441d7-1b57-48d8-8fd5-41d3b0d94f2b_26ca1996a20e8bd63617ab272d4eeede1d2d8e32'], 'smartThings': []}, 'version': 8, 'rssi': -48, 'fwVersion': '1.2.0', 'sledOnline': 'on', 'subChipFwVer': '1.2.0', 'subDevices': [{'subDevId': '132e464e3635361335363238', 'deviceid': 'ab300001fe', 'uiid': '130', 'index': 0}], 'timeZone': 2}

2022-09-26 16:16:10.719 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'**uiActive**': {'all': 1, 'time': 7200}} | 1664201770000

2022-09-26 16:16:10.942 WARNING (MainThread) [custom_components.sonoff.core.ewelink.cloud] Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-', 'sequence': '1664201770000'}

2022-09-26 16:16:40.768 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_00': 2} | 1664201800000
2022-09-26 16:16:40.868 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_01': 2} | DDoS | 1664201800001
2022-09-26 16:16:40.969 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_02': 2} | DDoS | DDoS | 1664201800002
2022-09-26 16:16:41.071 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_03': 2} | DDoS | DDoS | DDoS | 1664201801000

2022-09-26 16:16:41.185 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_00': '000200010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001000000000000000100000000000000000000000000000000000000000000000000000000000300000003000000000001000200010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664201800000
DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_01': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050001000000000000000100020000000000000000000000000008000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664201800001
2022-09-26 16:16:41.668 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_02': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664201800002
2022-09-26 16:16:41.713 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_03': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664201801000
AlexxIT commented 2 years ago

Ok. It answer with error on update command.

Try to call service manually. Change time value to check good one (without error). Try 60 or 180. You need to find maximum accepted.

http://192.168.1.123:8123/developer-tools/service

service: sonoff.send_command
data:
  device: ab300001fe
  uiActive:
    all: 1
    time: 7200
ocigam69 commented 2 years ago

Sorry AlexxIT. The same results:

2022-09-26 18:41:14.150 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-09-26 18:41:14.150 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-09-26 18:41:14.151 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'all': 1, 'time': 7200}} | 1664210474000
2022-09-26 18:41:14.374 WARNING (MainThread) [custom_components.sonoff.core.ewelink.cloud] Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-', 'sequence': '1664210474000'}

2022-09-26 18:42:19.811 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-09-26 18:42:19.812 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-09-26 18:42:19.812 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'all': 1, 'time': 3600000}} | 1664210539000
2022-09-26 18:42:20.056 WARNING (MainThread) [custom_components.sonoff.core.ewelink.cloud] Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-', 'sequence': '1664210539000'}

t.websocket_api_script] websocket_api script: Running websocket_api script
2022-09-26 18:43:20.121 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-09-26 18:43:20.122 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'all': 1, 'time': 60}} | 1664210600000
2022-09-26 18:43:20.349 WARNING (MainThread) [custom_components.sonoff.core.ewelink.cloud] Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-', 'sequence': '1664210600000'}

2022-09-26 18:43:42.223 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-09-26 18:43:42.223 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-09-26 18:43:42.224 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'all': 1, 'time': 180}} | 1664210622000
2022-09-26 18:43:42.497 WARNING (MainThread) [custom_components.sonoff.core.ewelink.cloud] Cloud ERROR: {'error': 400, 'deviceid': 'ab300001fe', 'apikey': 'acb441d7-1b57-48d8-8fd5-', 'sequence': '1664210622000'}
AlexxIT commented 2 years ago

Try to send update command only for one channel (0-3):

service: sonoff.send_command
data:
  device: ab300001fe
  uiActive:
    outlet: 3
    time: 60
ocigam69 commented 2 years ago

Ok! Screenshot_20220927-184658

I have one ligth in channel 0

service: sonoff.send_command data: device: ab300001fe uiActive: outlet: 0 time: 180

ocigam69 commented 2 years ago

Sorry AlexxIT, but entity switch not update. Example: switch.sonoff_ab300001fe_1 / 2 / 3 / 4

AlexxIT commented 2 years ago

Switch not depends on this settings. Check debug logs

ocigam69 commented 2 years ago

Hi @AlexxIT, with this, sensor data update correctly,

service: sonoff.send_command
data:
device: ab300001fe
uiActive:
outlet: 0
time: 180

Now debug for switch:

2022-09-28 22:08:57.601 INFO (MainThread) [homeassistant.setup] Setting up sonoff
2022-09-28 22:09:01.707 DEBUG (MainThread) [custom_components.sonoff] 24 devices loaded from Cloud
2022-09-28 22:09:01.715 INFO (MainThread) [homeassistant.components.switch] Setting up switch.sonoff
:
:
22-09-28 22:09:15.768 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:09:15.869 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 3, 'time': 180}} | DDoS | 1664395755006
2022-09-28 22:09:16.087 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395756000
2022-09-28 22:09:16.088 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Skipped disabled step call_service
2022-09-28 22:09:16.260 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] Can't decrypt message
Traceback (most recent call last):
  File "/config/custom_components/sonoff/core/ewelink/__init__.py", line 214, in local_update
    params = self.local.decrypt_msg(msg, device["devicekey"])
  File "/config/custom_components/sonoff/core/ewelink/local.py", line 300, in decrypt_msg
    return json.loads(data)
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2022-09-28 22:09:16.292 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'current_03': 0, 'voltage_03': 0, 'actPow_03': 0, 'reactPow_03': 0, 'apparentPow_03': 0} | None
:
:
2022-09-28 22:09:32.312 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] Can't decrypt message
Traceback (most recent call last):
  File "/config/custom_components/sonoff/core/ewelink/__init__.py", line 214, in local_update
    params = self.local.decrypt_msg(msg, device["devicekey"])
  File "/config/custom_components/sonoff/core/ewelink/local.py", line 300, in decrypt_msg
    return json.loads(data)
  File "/usr/local/lib/python3.10/json/__init__.py", line 341, in loads
    s = s.decode(detect_encoding(s), 'surrogatepass')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 2: invalid start byte
2022-09-28 22:09:32.369 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'current_03': 0, 'voltage_03': 0, 'actPow_03': 0, 'reactPow_03': 0, 'apparentPow_03': 0} | None
2022-09-28 22:09:32.512 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_00': 2} | 1664395772000
2022-09-28 22:09:32.613 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_01': 2} | DDoS | 1664395772001
2022-09-28 22:09:32.715 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_02': 2} | DDoS | DDoS | 1664395772002
2022-09-28 22:09:32.817 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'getKwh_03': 2} | DDoS | DDoS | DDoS | 1664395772003
2022-09-28 22:09:32.916 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_00': '000100010003000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010000000000000001000000000000000000000000000000000000000000000000000000000003000000030000000000010002000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664395772000
2022-09-28 22:09:32.918 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] 100173850d => Cloud4 | {'hundredDaysKwh': 'get'} | DDoS | DDoS | DDoS | DDoS | 1664395772004
2022-09-28 22:09:33.020 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] 1000bd89e0 => Cloud4 | {'hundredDaysKwh': 'get'} | DDoS | DDoS | DDoS | DDoS | DDoS | 1664395773000
2022-09-28 22:09:33.114 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_01': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500010000000000000001000200000000000000000000000000080002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664395772001
2022-09-28 22:09:33.122 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] 1000bd70f5 => Cloud4 | {'hundredDaysKwh': 'get'} | DDoS | DDoS | DDoS | DDoS | DDoS | DDoS | 1664395773001
2022-09-28 22:09:33.140 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 1000bd89e0 <= Cloud3 | {'hundredDaysKwhData': '000000000106000306000207000304000203000305000105000204000007000300000300000104000002000101000108000106000200000000000007000000000106000106000209000006000000000000000203000307000405000605000307000703000008000000000000000000000007000000000000000000000000000103000000000000000000000000000000000000000000000201000500000203000000000208000309000403000204000601000207000605000502000508000207000702000202000007000000000304000304000201000304000308000000000003000508010000000709000508000500000101000000000109000209000106000000000306000603000300000108000408000300000208000102000105000000000600000304000302000003'} | 1664395773000
2022-09-28 22:09:33.211 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 1000bd70f5 <= Cloud3 | {'hundredDaysKwhData': '000000000000000000000000000000000200000000000000000000000000000000000008000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000109000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664395773001
2022-09-28 22:09:33.392 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_02': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664395772002
2022-09-28 22:09:33.438 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'kwhHistories_03': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'} | 1664395772003
2022-09-28 22:09:33.485 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 1000bd89e0 <= Local3 | {'alarmVValue': [-1, -1], 'alarmCValue': [-1, 10], 'alarmPValue': [-1, -1], 'switch': 'off', 'startup': 'stay', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'off', 'power': 0, 'voltage': 236.58, 'current': 0, 'ssid': 'wrloci', 'bssid': 'de:07:b6:66:0c:c3'} | 12644
2022-09-28 22:09:33.526 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 1000bd89e0 <= Cloud3 | {'power': '0.00', 'voltage': '236.58', 'current': '0.00'} | None
2022-09-28 22:09:33.548 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Local3 | {'alarmVValue': [-1, -1], 'alarmCValue': [-1, 10], 'alarmPValue': [-1, -1], 'switch': 'on', 'startup': 'stay', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'off', 'power': 153.2, 'voltage': 239.19, 'current': 0.71, 'ssid': 'wrloci', 'bssid': '3c:98:72:06:86:21'} | 27915
2022-09-28 22:09:33.587 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Cloud3 | {'power': '153.21', 'voltage': '239.19', 'current': '0.71'} | None
2022-09-28 22:09:35.004 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Running automation actions
2022-09-28 22:09:35.004 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:09:35.005 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 0, 'time': 180}} | 1664395775000
2022-09-28 22:09:35.228 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395775001
2022-09-28 22:09:35.230 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:09:35.331 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 1, 'time': 180}} | DDoS | 1664395775002
2022-09-28 22:09:35.548 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395775003
2022-09-28 22:09:35.550 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:09:35.651 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 2, 'time': 180}} | DDoS | 1664395775004
2022-09-28 22:09:35.867 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395775005
:
:
2022-09-28 22:11:31.118 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:11:31.219 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 3, 'time': 180}} | DDoS | 1664395891001
2022-09-28 22:11:31.490 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395891002
2022-09-28 22:11:31.490 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Skipped disabled step call_service
2022-09-28 22:11:31.546 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Local3 | {'alarmVValue': [-1, -1], 'alarmCValue': [-1, 10], 'alarmPValue': [-1, -1], 'switch': 'on', 'startup': 'stay', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'off', 'power': 165.16, 'voltage': 238.29, 'current': 0.73, 'ssid': 'wrloci', 'bssid': '3c:98:72:06:86:21'} | 27942
2022-09-28 22:11:31.585 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Cloud3 | {'power': '165.16', 'voltage': '238.29', 'current': '0.73'} | None
2022-09-28 22:11:32.264 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] Can't decrypt message
Traceback (most recent call last):
  File "/config/custom_components/sonoff/core/ewelink/__init__.py", line 214, in local_update
    params = self.local.decrypt_msg(msg, device["devicekey"])
  File "/config/custom_components/sonoff/core/ewelink/local.py", line 300, in decrypt_msg
    return json.loads(data)
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2022-09-28 22:11:32.291 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] ab300001fe <= Cloud3 | {'current_03': 0, 'voltage_03': 0, 'actPow_03': 0, 'reactPow_03': 0, 'apparentPow_03': 0} | None
2022-09-28 22:11:33.179 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] 100173850d => Cloud4 | {'uiActive': 180} | 1664395893000
2022-09-28 22:11:33.422 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 100173850d <= Cloud3 | {'current': 0, 'voltage': 0, 'power': 0, 'dayKwh': 0, 'monthKwh': 7} | None
2022-09-28 22:11:33.445 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 100173850d <= Local0 | {'switches': [{'switch': 'off', 'outlet': 0}], 'configure': [{'startup': 'stay', 'outlet': 0}], 'pulses': [{'pulse': 'off', 'switch': 'off', 'outlet': 0, 'width': 500}], 'sledOnline': 'on', 'fwVersion': '1.0.6', 'rssi': -52, 'current': 0, 'voltage': 0, 'power': 0, 'dayKwh': 0, 'monthKwh': 7, 'ssid': 'wrloci', 'bssid': 'DE:07:B6:66:0C:C3'} | 2475
2022-09-28 22:11:33.489 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 1000bd89e0 <= Local3 | {'alarmVValue': [-1, -1], 'alarmCValue': [-1, 10], 'alarmPValue': [-1, -1], 'switch': 'off', 'startup': 'stay', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'off', 'power': 0, 'voltage': 236.65, 'current': 0, 'ssid': 'wrloci', 'bssid': 'de:07:b6:66:0c:c3'} | 12645
2022-09-28 22:11:33.519 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 1000bd89e0 <= Cloud3 | {'power': '0.00', 'voltage': '236.65', 'current': '0.00'} | None
2022-09-28 22:11:33.547 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Local3 | {'alarmVValue': [-1, -1], 'alarmCValue': [-1, 10], 'alarmPValue': [-1, -1], 'switch': 'on', 'startup': 'stay', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'off', 'power': 155.85, 'voltage': 238.58, 'current': 0.77, 'ssid': 'wrloci', 'bssid': '3c:98:72:06:86:21'} | 27943
2022-09-28 22:11:33.586 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Cloud3 | {'power': '155.85', 'voltage': '238.58', 'current': '0.77'} | None
2022-09-28 22:11:35.003 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Running automation actions
2022-09-28 22:11:35.004 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:11:35.004 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 0, 'time': 180}} | 1664395895000
2022-09-28 22:11:35.237 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395895001
2022-09-28 22:11:35.238 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:11:35.341 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 1, 'time': 180}} | DDoS | 1664395895002
2022-09-28 22:11:35.549 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Local3 | {'alarmVValue': [-1, -1], 'alarmCValue': [-1, 10], 'alarmPValue': [-1, -1], 'switch': 'on', 'startup': 'stay', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'off', 'power': 153.74, 'voltage': 238.29, 'current': 0.7, 'ssid': 'wrloci', 'bssid': '3c:98:72:06:86:21'} | 27944
2022-09-28 22:11:35.559 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395895003
2022-09-28 22:11:35.561 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:11:35.591 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 10005be25e <= Cloud3 | {'power': '153.74', 'voltage': '238.29', 'current': '0.70'} | None
2022-09-28 22:11:35.662 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 2, 'time': 180}} | DDoS | 1664395895004
2022-09-28 22:11:35.923 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | 1664395895005
2022-09-28 22:11:35.925 INFO (MainThread) [homeassistant.components.automation.update_spm] Update SPM: Executing step call service
2022-09-28 22:11:36.026 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.cloud] ab300001fe => Cloud4 | {'uiActive': {'outlet': 3, 'time': 180}} | DDoS | 1664395895006
2022-09-28 22:11:36.262 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] Can't decrypt message
:
:

If I press buttom in ewelink app, refresh ok in HA.

ocigam69 commented 2 years ago

Hello, any good news?

AlexxIT commented 2 years ago

Do you still have Can't decrypt message error?

AlexxIT commented 1 year ago

This problem should be fixed in latest master version

AlexxIT commented 1 year ago

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

mstsclev commented 1 week ago

Good afternoon! I am using the SPM-Main + SPM-4Relay set, with the latest firmware version from the manufacturer as of today: 1.3. I am able to control the device, and all 4 relays are working correctly. However, the energy monitoring sensors are not displaying any information. I initially thought this part of the integration was not functioning, but as soon as I entered the "Energy Consumption" section in the eWeLink app, the data in the integration immediately updated and continued to refresh for a while after I closed the app. What could be the reason for this? What do you need from me to help us try to resolve this issue?

sonoff-01JBXR43MSGE7S4E9VR5PE8GDK-Device000e53-803a75986228f147e3c94a2a76935b58 (1).json sonoff-01JBXR43MSGE7S4E9VR5PE8GDK-Device000e53-803a75986228f147e3c94a2a76935b58.json

AlexxIT commented 1 week ago

Answer in the docs

mstsclev commented 1 week ago

Did I understand correctly that the solution is to configure "sonoff_lan_mode_r3"? If not, I would greatly appreciate a link to the documentation. I’m not very familiar with this topic and am dealing with this task for the first time. Apologies for the basic questions.

AlexxIT commented 1 week ago

This is about power devices https://github.com/AlexxIT/SonoffLAN?tab=readme-ov-file#sonoff-pow

You can enable debug logs and check if SonoffLAN constantly requesting power info from your device