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.61k stars 407 forks source link

Energy monitoring #1141

Closed b16crxt closed 1 year ago

b16crxt commented 1 year ago

Trying to add a sonoff s31 for energy monitoring but it doesn’t show up. My tazmotized ones do, but I hoped the original firmware would as well. Homeassistant says it’s a bug and to send you this link. Thanks for what you do! https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics

gravityfargo commented 1 year ago

I have the S31TPB, and I get energy monitoring right after I start the integration, but it stops after a few minutes.

AlexxIT commented 1 year ago

Download device diagnostics

akshaya-a commented 1 year ago

I have the same issue, here is my diagnostic

 {
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.3.6",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.10",
    "docker": true,
    "arch": "aarch64",
    "timezone": "America/Los_Angeles",
    "os_name": "Linux",
    "os_version": "5.15.90",
    "supervisor": "2023.03.3",
    "host_os": "Home Assistant OS 9.5",
    "docker_version": "20.10.22",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "smartthinq_sensors": {
      "version": "0.31.4",
      "requirements": [
        "pycountry>=20.7.3",
        "xmltodict>=0.12.0",
        "cchardet>=2.1.7"
      ]
    },
    "teamtracker": {
      "version": "0.1",
      "requirements": [
        "arrow",
        "aiofiles"
      ]
    },
    "mail_and_packages": {
      "version": "0.3.10",
      "requirements": [
        "beautifulsoup4",
        "Pillow>=9.0"
      ]
    },
    "hacs": {
      "version": "1.31.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "eufy_security": {
      "version": "6.2.0",
      "requirements": [
        "websocket-client==1.1.0",
        "aiortsp==1.3.6"
      ]
    },
    "adaptive_lighting": {
      "version": "1.7.0",
      "requirements": []
    },
    "sonoff": {
      "version": "3.5.1",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "sonos_cloud": {
      "version": "0.3.5",
      "requirements": []
    },
    "o365": {
      "version": "v4.2.8",
      "requirements": [
        "O365==2.0.26",
        "BeautifulSoup4>=4.10.0"
      ]
    },
    "alexa_media": {
      "version": "4.6.2",
      "requirements": [
        "alexapy==1.26.5",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    }
  },
  "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.5.1",
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "version": "122751c",
    "cloud_auth": true,
    "config": null,
    "options": {},
    "errors": [],
    "device": {
      "uiid": 32,
      "params": {
        "bindInfos": "***",
        "version": 8,
        "only_device": {
          "ota": "success"
        },
        "sledOnline": "on",
        "ssid": "***",
        "bssid": "***",
        "fwVersion": "3.5.0",
        "staMac": "***",
        "rssi": -56,
        "init": 1,
        "alarmType": "pcv",
        "alarmVValue": [
          -1,
          -1
        ],
        "alarmCValue": [
          -1,
          -1
        ],
        "alarmPValue": [
          -1,
          -1
        ],
        "switch": "off",
        "startup": "stay",
        "pulse": "off",
        "pulseWidth": 500,
        "power": "0.00",
        "voltage": "120.96",
        "current": "0.00",
        "oneKwh": "start",
        "timeZone": -7,
        "uiActive": 120,
        "hundredDaysKwh": "get",
        "endTime": "",
        "startTime": "2022-10-03T04:40:12.999Z",
        "demNextFetchTime": 1680332400000
      },
      "model": "S31TPB(US)",
      "online": true,
      "local": true,
      "localtype": "enhanced_plug",
      "host": "192.168.1.151:8081",
      "deviceid": "10014f7ce5"
    }
  }
}
AlexxIT commented 1 year ago

So S31 has POW2 firmware. Energy sensor disabled by default. You need to enable it manually on device page.

Brandw9957 commented 11 months ago

Did you ever get this to work? I'm not sure where to enable it