8000 IPCamera EC60 (US) not discovered · Issue #1241 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

IPCamera EC60 (US) not discovered #1241

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

Closed
Puxtril opened this issue Nov 10, 2024 · 6 comments · Fixed by #1270
Closed

IPCamera EC60 (US) not discovered #1241

Puxtril opened this issue Nov 10, 2024 · 6 comments · Fixed by #1270

Comments

@Puxtril
Copy link
Contributor
Puxtril commented Nov 10, 2024

python-kasa is not able to discover the EC60 smart camera device. Running kasa --debug --device-family SMART.IPCAMERA discover shows DEBUG:kasa.discover:[DISCOVERY] Unable to find device type for 192.168.0.XXX: Unable to find the device type field!. So I checked the device info struct and see it has one more nest of system:

{
  "system": {
    "get_sysinfo": {
      "system": {
        "stream_version": 2,
        "sw_ver": "2.3.22 Build 20230731 rel.69808",
        "hw_ver": "4.0",
        "type": "IOT.IPCAMERA"

I can create a PR, including an new fixture.

@sdb9696
Copy link
Collaborator
sdb9696 commented Nov 10, 2024

This is confusing as we only support SMART cameras with —experimental but this appears to be an IOT.CAMERA. Are you able to paste the whole discovery response (redacted)?

@Puxtril
Copy link
Contributor Author
Puxtril commented Nov 10, 2024

Yea here's the data, manually scrubbed. I was trying to generate a fixture via python -m devtools.dump_devinfo --experimental --host 192.168.0.XXX but got an error kasa.exceptions.UnsupportedDeviceError: Unknown device type: IOT.IPCAMERA

I'm not familiar with the experimental flag, how can I test with that?

Scrubbed data
{
  "system": {
    "get_sysinfo": {
      "system": {
        "stream_version": 2,
        "sw_ver": "2.3.22 Build 20230731 rel.69808",
        "hw_ver": "4.0",
        "type": "IOT.IPCAMERA",
        "model": "EC60(US)",
        "dev_name": "Kasa Spot, 24/7 Recording",
        "alias": "Kasa_Cam",
        "mic_mac": "000000000000",
        "mac": "00:00:00:00:00:00",
        "hwId": "0000000000000000000000000000000000000000",
        "oemId": "0000000000000000000000000000000000000000",
        "deviceId": "0000000000000000000000000000000000000000",
        "system_time": 1690803724,
        "c_opt": [
          0,
          1
        ],
        "new_feature": [
          2,
          3,
          4,
          5,
          7,
          9
        ],
        "f_list": [
          1,
          2
        ],
        "rssi": -50,
        "latitude": 0.000000,
        "longitude": 0.000000,
        "led_status": "on",
        "camera_switch": "on",
        "resolution": "720P",
        "updating": false,
        "status": "new",
        "bind_status": false,
        "last_activity_timestamp": 0,
        "a_type": 2,
        "is_cal": 1
      },
      "err_code": 0
    }
  }
}

@rytilahti
Copy link
Member
rytilahti commented Nov 10, 2024

The discovery protocol is similar to other kasa devices, but support for these cameras is not currently implemented. See the stale PR #537 for some details on the protocol itself. The comms seems to be:

  • HTTPS on port 10443
  • POST requests on /data/LINKIE.json
  • Request data follows the format used by "IOT" devices as expected.
  • Payload: base64-encoded, url-encoded xor-encrypted, passed in POST data under content key: (content=quote(base64(xor_encrypted_payload)))

If you are interested in reviving that PR (the code base has changed quite a bit when it comes to protocol handling), we can help with that :-)

@Puxtril
Copy link
Contributor Author
Puxtril commented Nov 10, 2024

I can try to revive it, though I'm new to the IOT world so I'll need time to familiarize myself with the PR contents.

@rytilahti
Copy link
Member

I would recommend not trying to revive it as is (at least not yet), but rather use it as a starting point to understand the details & making smaller PRs to add individual parts separately.

I'd recommend the following, separate steps in the following order:

  • Implementing the transport protocol, so that you can use kasa command in the cli to test commands. You can take a look into the file in that PR, but the implementation will differ as we have restructured the code base since then to make it easier to support new transports.
  • Implementing a very basic IotCamera class (inheriting from IotDevice), the code in that PR is a good starting point to work on, but I'd start with just the basics (i.e., work on the information & commands in the main "module").
  • Update devtools.dump_devinfo to perform the extra queries and create a fixture file for this device.
  • Add ptz module and implement Features like done in other modules
  • Add support for discovery, this could also be done after getting a basic IotCamera implemented, before starting to look into the ptz module.

As you can see, there is quite a bit of work involved in this, but we can help along the way to make it happen. I have an open PR to add support for another new transport (#943) that is somewhat similar in a sense that it's also using HTTPS and POST requests, so maybe it's time that I dig into how to do that properly and then help you with yours.

If you are on the homeassistant discord, feel free to message me (I'm using the same handle there) and I will try to explain & help you when needed.

@Puxtril
Copy link
Contributor Author
Puxtril commented Nov 10, 2024

Thanks for all the guidance with this! Breaking it up into smaller chunks is much more manageable, I was getting daunted looking at that PR... But I've already bought the device, so I definitely want to see this supported haha.

I'll start looking at the transport protocol this week. If I have any smaller questions as I work through this, I'll reach out on Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0