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

IKEA INSPELNING support #98

Merged
merged 3 commits into from
Sep 24, 2024
Merged

IKEA INSPELNING support #98

merged 3 commits into from
Sep 24, 2024

Conversation

AboveColin
Copy link
Contributor

@AboveColin AboveColin commented Sep 23, 2024

Added support for the IKEA INSPELNING

If any attributes are unnecessary or anything else needed to be changed before a marge, let me know! :)

This is an example of a JSON output of an IKEA INSPELNING:

{
        "id": "STRING",
        "type": "outlet",
        "deviceType": "outlet",
        "createdAt": "2024-09-20T13:32:15.000Z",
        "isReachable": true,
        "lastSeen": "2024-09-23T15:27:26.000Z",
        "attributes": {
            "customName": "Extra",
            "firmwareVersion": "2.4.45",
            "hardwareVersion": "1",
            "manufacturer": "IKEA of Sweden",
            "model": "INSPELNING Smart plug",
            "productCode": "E2206",
            "serialNumber": "SERIALNUMBER",
            "isOn": false,
            "startupOnOff": "startPrevious",
            "lightLevel": 41,
            "startUpCurrentLevel": -1,
            "currentActivePower": 0,
            "energyConsumedAtLastReset": 0,
            "currentAmps": 0.003000000026077032,
            "currentVoltage": 230.89999389648438,
            "timeOfLastEnergyReset": "2024-09-20T12:58:04.000Z",
            "totalEnergyConsumed": 0.5249999761581421,
            "totalEnergyConsumedLastUpdated": "2024-09-23T15:27:26.000Z",
            "childLock": false,
            "statusLight": false,
            "identifyPeriod": 0,
            "identifyStarted": "2000-01-01T00:00:00.000Z",
            "permittingJoin": false,
            "otaPolicy": "autoUpdate",
            "otaProgress": 0,
            "otaScheduleEnd": "00:00",
            "otaScheduleStart": "00:00",
            "otaState": "readyToCheck",
            "otaStatus": "upToDate"
        },
        "capabilities": {
            "canSend": [],
            "canReceive": [
                "customName",
                "isOn",
                "lightLevel",
                "energyConsumedAtLastReset",
                "childLock",
                "statusLight"
            ]
        },
        "room": {
            "id": "ROOMID",
            "name": "Huis",
            "color": "ikea_green_no_65",
            "icon": "rooms_arm_chair"
        },
        "deviceSet": [],
        "remoteLinks": [],
        "isHidden": false
    }

Example output in python:

    print("Outlet name:", outlet.attributes.custom_name)
    print("Outlet is on:", outlet.attributes.is_on)
    print("Outlet energy consumed at last reset:", outlet.attributes.energy_consumed_at_last_reset)
    print("Outlet current active power:", outlet.attributes.current_active_power)
    print("Outlet current amps:", outlet.attributes.current_amps)
    print("Outlet current voltage:", outlet.attributes.current_voltage)
    print("Outlet total energy consumed:", outlet.attributes.total_energy_consumed)
    print("Outlet total energy consumed last updated:", outlet.attributes.total_energy_consumed_last_updated)
    Outlet name: Extra
    Outlet is on: False
    Outlet energy consumed at last reset: 0.0
    Outlet current active power: 0.0
    Outlet current amps: 0.003000000026077032
    Outlet current voltage: 230.89999389648438
    Outlet total energy consumed: 0.5249999761581421
    Outlet total energy consumed last updated: 2024-09-23 15:27:26+00:00

@AboveColin
Copy link
Contributor Author

Got a notification from the pipeline, will adjust with the feedback :)

@Leggin
Copy link
Owner

Leggin commented Sep 23, 2024

Hey thank you for the PR! Regarding the pipeline issues, you actually don't need to add custom_name, firmware, etc. its already defined in https://github.com/AboveColin/dirigera/blob/e9fbcd6b6d33592c99197ece7d1c4381bc0b9971/src/dirigera/devices/device.py#L15
so the attributes are already there. You only need to have the new ones.

@AboveColin
Copy link
Contributor Author

AboveColin commented Sep 24, 2024

updated 👀

@Leggin
Copy link
Owner

Leggin commented Sep 24, 2024

Yeah alright, linter is having issues, but your stuff looks great! will merge.

@Leggin Leggin merged commit 2918080 into Leggin:main Sep 24, 2024
1 of 7 checks passed
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 this pull request may close these issues.

2 participants