Skip to main content

Sharp Cocoro Air SDK in python

Basically a quick and dirty conversion of https://github.com/dvcrn/cocoro-sdk/ into python. Probably some bugs along the way.

Installation

uv add sharp-cocoro

Or install from source:

git clone https://github.com/dvcrn/sharp-cocoro
cd sharp-cocoro
uv sync

Usage:

For auth, read: https://github.com/dvcrn/cocoro-sdk/tree/master?tab=readme-ov-file#authentication

async def main():
    app_secret = ''
    app_key = ''
    # iClub is the default service name, you can also leave it out
    async with Cocoro(app_secret=app_secret, app_key=app_key) as cocoro:
        await cocoro.login()
        devices = await cocoro.query_devices()
        device = devices[0]


        all_props = device.get_all_properties()
        for prop in all_props:
            print(prop)

        if isinstance(device, Aircon):
            aircon = device

            print("power state")
            print(device.get_power_status())

            device.queue_temperature_update(23.5)
            aircon.queue_power_on()
            device.queue_property_status_update(aircon.get_property_status(StatusCode.OPERATION_MODE))

            print(await cocoro.execute_queued_updates(aircon))
        else:
            print("The first device is not an Aircon")

# Run the async function
asyncio.run(main())

To get a property:

# example: get the operation mode
status = device.get_property_status(StatusCode.OPERATION_MODE.value)
assert isinstance(status, SinglePropertyStatus)
print(ValueSingle(status.valueSingle['code'])) # returns the operation mode

To set it:

device.queue_property_status_update(ValueSingle.OPERATION_COOL)
await cocoro.execute_queued_updates(device)

To get an overview of all properties available

device.dump_all_properties()

# 動作状態 (80): ON (30), set=True get=True options=['ON', 'OFF']
# 冷房モード時温度設定値 (B5): None, set=True get=True
# ...

Each property also includes information on

  • It's type (binary, single, range)
  • Whether it is settable or gettable
  • And options that are allowed. In the example above, we can set the power mode only to ON or OFF

License

MIT

Metadata

Release files for sharp-cocoro 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sharp-cocoro 0.2.3
File Size Uploaded
sharp_cocoro-0.2.3.tar.gz 4.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for sharp-cocoro 0.2.3
File Interpreter ABI Platform
sharp_cocoro-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 MB

Release files / sharp_cocoro-0.2.3.tar.gz

Download URL sharp_cocoro-0.2.3.tar.gz
Size 4.7 MB
Tags Source
SHA-256 checksum
How to use checksums
adcc5503c9631b1f6c4f215a5cd1126182ffb5bfb3f4e0aebc77c90c4e871757
BLAKE2b-256 checksum
How to use checksums
4d9b499080be27e60e1f9e4597f5ab5dfd48a4b86c7648e482df8aac111001db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / sharp_cocoro-0.2.3-py3-none-any.whl

Download URL sharp_cocoro-0.2.3-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24b3574b264e89119d1ffa1145125b279968018138eb06aeecbd3f8bfd71ca38
BLAKE2b-256 checksum
How to use checksums
1f33665d3d7764e9e085bd6503bdeedf93b207632f36607e661c879cdc77442b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page