Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support strong guy ST-03 #1304

Closed
POl1arBear opened this issue Jan 5, 2024 · 6 comments
Closed

Add support strong guy ST-03 #1304

POl1arBear opened this issue Jan 5, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@POl1arBear
Copy link

POl1arBear commented Jan 5, 2024

{
  "home_assistant": {
    "installation_type": "Home Assistant Container",
    "version": "2023.12.3",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.11.6",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Asia/Taipei",
    "os_name": "Linux",
    "os_version": "6.0.7-301.fc37.x86_64",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.33.0.2",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "tapo": {
      "version": "2.12.2",
      "requirements": [
        "plugp100==4.0.1"
      ]
    },
    "sonoff": {
      "version": "3.5.4",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    }
  },
  "integration_manifest": {
    "domain": "sonoff",
    "name": "Sonoff",
    "codeowners": [
      "@AlexxIT"
    ],
    "config_flow": true,
    "dependencies": [
      "http",
      "zeroconf"
    ],
    "documentation": "https://github.com/AlexxIT/SonoffLAN",
    "iot_class": "local_push",
    "issue_tracker": "/api/sonoff/24e93516-f142-4bc9-853e-ad724e288c0a",
    "requirements": [
      "pycryptodome>=3.6.6"
    ],
    "version": "3.5.4",
    "is_built_in": false
  },
  "data": {
    "version": "a4a8c5f",
    "cloud_auth": true,
    "config": null,
    "options": {
      "mode": "auto",
      "debug": true
    },
    "errors": [],
    "device": {
      "uiid": 91,
      "params": {
        "version": 8,
        "sledOnline": "on",
        "ssid": "***",
        "bssid": "***",
        "rssi": -67,
        "fwVersion": "3.4.3",
        "staMac": "***",
        "op": 1
      },
      "model": "ST-03",
      "online": true,
      "local": null,
      "localtype": null,
      "host": null,
      "deviceid": "10013f1eb8"
    }
  }
}
@POl1arBear
Copy link
Author

POl1arBear commented Jan 5, 2024

2024-01-05 10:23:05 [D] SysInfo: {'installation_type': 'Home Assistant Container', 'version': '2023.12.3', 'dev': False, 
'hassio': False, 'virtualenv': False, 'python_version': '3.11.6', 'docker': True, 'arch': 'x86_64', 'timezone': 'Asia/Taipei', 'os_name': 'Linux', 'os_version': '6.0.7-301.fc37.x86_64', 'user': 'root', 'sonoff_version': '3.5.4 (a4a8c5f)'}
2024-01-05 10:23:05 [D] 4 devices loaded from Cloud
2024-01-05 10:23:05 [D] 10013f1eb8 UIID 0091 | {'version': 8, 'sledOnline': 'on', 'rssi': -67, 'fwVersion': '3.4.3', 'op': 1}
2024-01-05 10:23:05 [D] a94000c586 UIID 0120 | {'addr': '4D7F2215', 'protocol': '1'}
2024-01-05 10:23:05 [D] a94000c585 UIID 0120 | {'addr': '5367D312', 'protocol': '1'}
2024-01-05 10:23:05 [D] a940008911 UIID 0120 | {'addr': 'CF595CEE', 'protocol': '1'}
2024-01-05 10:23:05 [D] AUTO mode start
2024-01-05 10:23:06 [D] CLOUD None => True
2024-01-05 10:23:06 [D] Add 4 entities
2024-01-05 11:34:34 [D] 10013f1eb8 <= Cloud3 | {'op': 1} | 1704454474246
2024-01-05 11:34:46 [D] 10013f1eb8 <= Cloud3 | {'op': 2} | 1704454486021
2024-01-05 11:34:48 [D] 10013f1eb8 <= Cloud3 | {'op': 3} | 1704454488360
2024-01-05 11:40:54 [D] 10013f1eb8 <= Cloud3 | {'op': 1} | 1704454854205
2024-01-05 11:40:57 [D] 10013f1eb8 <= Cloud3 | {'op': 2} | 1704454857658
2024-01-05 11:41:00 [D] 10013f1eb8 <= Cloud3 | {'op': 3} | 1704454859745
2024-01-05 11:58:39 [D] 10013f1eb8 <= Cloud3 | {'op': 3} | 1704455918728

@AlexxIT AlexxIT added the enhancement New feature or request label Jan 5, 2024
@AlexxIT AlexxIT self-assigned this Jan 5, 2024
@POl1arBear
Copy link
Author

op1=open
op2=stop
op3=close

@POl1arBear
Copy link
Author

IMG_9973

@AlexxIT AlexxIT changed the title support strong guy st-03 Add support strong guy ST-03 Feb 13, 2024
@AlexxIT AlexxIT added this to the v3.5.5 milestone Feb 13, 2024
AlexxIT added a commit that referenced this issue Feb 14, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Feb 16, 2024

@AlexxIT AlexxIT closed this as completed Feb 16, 2024
@POl1arBear
Copy link
Author

POl1arBear commented Mar 1, 2024

Thank you for the update, but it's a bit different from what I had in mind
So I made some changes to the files
First, I made changes to the YAML file

sonoff:
  devices:
    100xxxxxxx:
      device_class: switch

and devices.py

from ..switch import (
  .
  .
  .
   XButton91,
)

and switch.py

class XButton91(XEntity, SwitchEntity):
    params = {"op"}

    def set_state(self, params: dict):
        self._attr_is_on = params["op"] == 1

    async def async_turn_on(self, *args, **kwargs):
        await self.ewelink.send(self.device, {"op": 1})

    async def async_turn_off(self):
        await self.ewelink.send(self.device, {"op": 2})

It works perfectly

But I also want to add another switch on the same device, roughly like this.

class XButton91off(XEntity, SwitchEntity):
    params = {"op"}

    def set_state(self, params: dict):
        self._attr_is_on = params["op"] == 3

    async def async_turn_on(self, *args, **kwargs):
        await self.ewelink.send(self.device, {"op": 3})

    async def async_turn_off(self):
        await self.ewelink.send(self.device, {"op": 2})

How should I proceed?

@AlexxIT AlexxIT reopened this Mar 1, 2024
@AlexxIT AlexxIT removed this from the v3.5.5 milestone Mar 1, 2024
AlexxIT added a commit that referenced this issue Apr 17, 2024
@AlexxIT AlexxIT added this to the v3.7.0 milestone Apr 17, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 17, 2024

I have rewrited from sensor to cover
https://github.com/AlexxIT/SonoffLAN/releases/tag/v3.7.0

@AlexxIT AlexxIT closed this as completed Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants