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

Does not support EP40: Outside outlet device with two switched outlets. #11

Open
dwilliams459 opened this issue Dec 10, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dwilliams459
Copy link

dwilliams459 commented Dec 10, 2022

Thanks for this repo! It does not seem to work with the outside plug EP40 with two switches. Refer to the draft pull request to see my attempt to get this to work. Documentation found https://community.home-assistant.io/t/tp-link-kasa-kp400-2-outlet-support/113135/9 suggests adding a 'context' node like:
{"system":{"set_relay_state":{"state":0}},"context":{"child_ids":["000000000000000000000000"]}}.
This did not seem to work for me, however it may be close to the correct solution.
Draft PR: #10
I have not tried lostmsu's power strip solution in from PR #3.

@dwilliams459 dwilliams459 changed the title This is not supporting EP40: outlet device with two plugs. Does not support EP40: Outside outlet device with two switched outlets. Dec 10, 2022
@Aldaviva Aldaviva added the needs new hardware Requires purchase of new hardware to develop and test label Mar 26, 2023
@Aldaviva Aldaviva added enhancement New feature or request and removed needs new hardware Requires purchase of new hardware to develop and test labels Oct 26, 2024
@Aldaviva Aldaviva self-assigned this Oct 26, 2024
@Aldaviva
Copy link
Owner

A generous donor is providing an EP40 for testing and development. Thanks for the documentation and pull requests, we'll get it working one way or another.

@Aldaviva
Copy link
Owner

Aldaviva commented Oct 28, 2024

Received the EP40. Here is a sample of a command to turn on outlet 1.

{
    "context" : {
        "child_ids" : [ "800648C61B22DD1DE8AFD8858B29192022087E7200" ],
        "source" : "46a4d58b-6279-432c-ae23-e115c2db8354"
    },
    "system" : {
        "set_relay_state" : {
            "state" : 1
        }
    }
}

Outlet 2 is the same but uses the other child ID from the children array returned by get_sysinfo:

{
    "system" : {
        "get_sysinfo" : {
            "alias" : "EP40",
            "child_num" : 2,
            "children" : [
                {
                    "alias" : "Plug 1",
                    "id" : "800648C61B22DD1DE8AFD8858B29192022087E7200",
                    "next_action" : {
                        "type" : -1
                    },
                    "on_time" : 0,
                    "state" : 0
                },
                {
                    "alias" : "hv",
                    "id" : "800648C61B22DD1DE8AFD8858B29192022087E7201",
                    "next_action" : {
                        "type" : -1
                    },
                    "on_time" : 0,
                    "state" : 0
                }
            ],
            "deviceId" : "800648C61B22DD1DE8AFD8858B29192022087E72",
            "err_code" : 0,
            "feature" : "TIM",
            "hwId" : "B3B7B05B758C3EDA8F9C69FECDBA2111",
            "hw_ver" : "1.0",
            "latitude_i" : 373548,
            "led_off" : 0,
            "longitude_i" : -1219823,
            "mac" : "F0:A7:31:C6:48:65",
            "mic_type" : "IOT.SMARTPLUGSWITCH",
            "model" : "EP40(US)",
            "ntc_state" : 0,
            "oemId" : "2F9215F1DCBF7DC17F80E2B0CACD47FC",
            "rssi" : -53,
            "status" : "new",
            "sw_ver" : "1.0.3 Build 220803 Rel.172301",
            "updating" : 0
        }
    }
}

Renaming an individual outlet:

{
    "context": {
        "child_ids": [
            "800648C61B22DD1DE8AFD8858B29192022087E7201"
        ],
        "source": "46a4d58b-6279-432c-ae23-e115c2db8354"
    },
    "system": {
        "set_dev_alias": {
            "alias": "plug2"
        }
    }
}

ep40-filtered.pcapng.gz

Aldaviva added a commit that referenced this issue Nov 1, 2024
…utlets [working, partially tested, needs XML documentation]
@Aldaviva
Copy link
Owner

Aldaviva commented Nov 1, 2024

This library is working with the EP40 on the ep40 branch. The context.child_ids approach works fine.

The high-level API is backwards compatible with version 1.0 of this library, so I plan to release this as 1.1. A new KasaMultiOutlet class was added with an IKasaMultiOutlet interface, with some new methods that take a leading outlet index argument. The library is still typesafe based on which class is constructed.

Example usage:

using IKasaMultiOutlet ep40 = new KasaMultiOutlet("192.168.1.100");
ep40.System.SetOutletOn(0, true); // turn on the first outlet

The readme documentation has been updated, but more XML documentation is required in the C# files.

I have tested the system commands successfully, but not the timer or schedule commands yet. I also updated the device firmware from factory version 1.0.3 to the latest version 1.0.4 and haven't noticed any differences yet.

@Aldaviva
Copy link
Owner

Aldaviva commented Nov 2, 2024

Added all XML documentation, published as prerelease version 1.1.0-beta1 on NuGet Gallery.

@Aldaviva Aldaviva added this to the 1.1.0 milestone Nov 2, 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