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.67k stars 414 forks source link

Cannot control POW316D using a device control swicth #1131

Closed d1964b closed 1 year ago

d1964b commented 1 year ago

Not sure if this is related to the other POW316D issues or not ? In my case I have added the device to my WiFi and can control the device through the EweLink App. When I switch it on/off in the Ewelink app the device control toggle switch on the HA dashboard also follows its state. However if I try to switch on the device using the device control switch in HA dashboard , the device control goes blue for a few seconds then falls back to off ( grey).

The logs show the message :

2023-03-05 16:49:50.456 WARNING (MainThread) [custom_components.sonoff.core.ewelink.local] 10017a20ec => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '1678034990000', 'seq': 155, 'error': 400, 'encrypt': True}

the diagnostics for the device is :

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.2.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "5.15.72",
    "supervisor": "2023.01.1",
    "host_os": "Home Assistant OS 9.2",
    "docker_version": "20.10.17",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "octopusagile": {
      "version": "2022.10.0b0",
      "requirements": []
    },
    "sonoff": {
      "version": "3.4.0",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "hacs": {
      "version": "1.31.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "sonoff",
    "name": "Sonoff",
    "config_flow": true,
    "documentation": "https://github.com/AlexxIT/SonoffLAN",
    "issue_tracker": "/api/sonoff/93938b50-5b50-4d86-b3ec-9f587c13007c",
    "codeowners": [
      "@AlexxIT"
    ],
    "dependencies": [
      "http",
      "zeroconf"
    ],
    "requirements": [
      "pycryptodome>=3.6.6"
    ],
    "version": "3.4.0",
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "version": "5406fa7",
    "cloud_auth": true,
    "config": {
      "username": "***",
      "password": "***",
      "mode": "auto"
    },
    "options": {
      "mode": "local",
      "debug": true
    },
    "errors": [
      {
        "name": "custom_components.sonoff.core.ewelink.local",
        "message": [
          "10017a20ec => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '1678034197000', 'seq': 111, 'error': 400, 'encrypt': True}",
          "10017a20ec => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '1678034272000', 'seq': 113, 'error': 400, 'encrypt': True}",
          "10017a20ec => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '1678034368000', 'seq': 133, 'error': 400, 'encrypt': True}",
          "10017a20ec => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '1678034530000', 'seq': 139, 'error': 400, 'encrypt': True}",
          "10017a20ec => Local4 | {'switches': [{'outlet': 0, 'switch': 'on'}]} <= {'sequence': '1678034990000', 'seq': 155, 'error': 400, 'encrypt': True}"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/sonoff/core/ewelink/local.py",
          214
        ],
        "timestamp": 1678034990.4564912,
        "exception": "",
        "count": 8,
        "first_occurred": 1678033729.8944318
      }
    ],
    "device": {
      "uiid": 190,
      "params": {
        "bindInfos": "***",
        "version": 8,
        "demNextFetchTime": 1678057200000,
        "ssid": "***",
        "bssid": "***",
        "fwVersion": "1.0.7",
        "current": 0,
        "voltage": 0,
        "power": 0,
        "uiActive": 60,
        "timeZone": 0,
        "dayKwh": 7,
        "monthKwh": 7,
        "switches": [
          {
            "switch": "off",
            "outlet": 0
          }
        ],
        "configure": [
          {
            "startup": "off",
            "outlet": 0
          }
        ],
        "pulses": [
          {
            "pulse": "off",
            "switch": "off",
            "outlet": 0,
            "width": 500
          }
        ],
        "rssi": -57,
        "threshold": {
          "actPow": {
            "min": 10,
            "max": 400000
          },
          "voltage": {
            "min": 18500,
            "max": 26400
          },
          "current": {
            "min": 10,
            "max": 1600
          }
        },
        "getHoursKwh": {
          "start": 4464,
          "end": 4535
        },
        "operSide": 1
      },
      "model": "POWR316D",
      "online": true,
      "localtype": "plug",
      "host": "192.168.0.154:8081",
      "deviceid": "10017a20ec"
    }
  }
}
AlexxIT commented 1 year ago

You need enable auto mode and get logs when you control this device from ewelink app

AlexxIT commented 1 year ago

Should be fixed in latest master version

AlexxIT commented 1 year ago

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