cocoro
Tools for COCORO API (SHARP products).
Install and Usage
Using pip
$ pip install cocoro
Using source code
Use poetry to setup the environment.
$ pip install poetry
$ git clone https://github.com/rcmdnk/cocoro.git
$ cd cocoro
$ poetry install
Appliances
API commands were taken for Sharp, KI-JS50 (humidifying air purifier, KI-JS50 加湿空気清浄機/空気清浄機:シャープ).
It may work for other (humidifying) air purifiers.
Requirement
You need to get appSecret and terminalAppIdKey to control appliances.
To get them, you can use mitmproxy.
By using mitmproxy, you will see following POST command while you are controlling COCORO in your smart phone:
POST https://hms.cloudlabs.sharp.co.jp/hems/pfApi/ta/setting/login/?appSecret=XXXXXXXXX…
← 200 application/json 38b 308ms
Open this command and you will see following in `Request tab:
2021-02-21 21:55:40 POST https://hms.cloudlabs.sharp.co.jp/hems/pfApi/ta/setting/login/?app
Secret=<*************appSecret**********************>&serviceName=
iClub
← 200 OK application/json 38b 308ms
Request Response Detail
Host: hms.cloudlabs.sharp.co.jp
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Accept: */*
User-Agent: smartlink_v200i Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X)
AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
Content-Length: 110
Accept-Language: ja-jp
Accept-Encoding: gzip, deflate, br
JSON [m:auto]
{
"terminalAppId":
"https://db.cloudlabs.sharp.co.jp/clpf/key/<************terminalAppIdKey*************>"
}
Find appSecret and terminalAppIdKey values from above details.
Then, make following configuration file as ~/.config/cocoro/config.yml:
---
appSecret: <*************appSecret**********************>
terminalAppIdKey: <************terminalAppIdKey*************>
Usage
If you installed cocoro by pip, do:
$ cocoro <cmd> [options]
If you installed from source code, go to cocoro directory, then do:
$ poetry run cocoro <cmd> [options]
Available commands (<cmd>) are:
switch <target>: Control switch. Available targets:on,off.humidification <target>: Control humidification. Available targets:on,off.humi <target>: Alias of humidification.mode <target>: Control mode. Available targets:auto,sleep,pollen,quiet,medium,high,recommendation,effectiveinfo [key]: Show the appliance information. The available keys are:full(full echonetData),labelData,maker,model,deviceType,name,place,yomi,zipCdIf no key is give, labelData is shown.version: Show version.help: Show help.
Other options:
--config_file <file>: Set configuration file. Default file path is~/.config/cocoro/config.yml.--appSecret <appSecret>: Set appSecret (overwrite the value of config_file).--terminalAppIdKey <terminalAppIdKey>: Set terminalAppIdKey (overwrite the value of config_file).--name <name>: Set name of the device. If no name is given, the first device is used.--log_level <level>: Set log level. The available levels are:debug,info,warningfatal.
Examples
$ cocoro switch on
[INFO][Cocoro] Succeeded to control js50: switch on
$ cocoro humi off
[INFO][Cocoro] Succeeded to control js50: humidification off
$ cocoro mode auto
[INFO][Cocoro] Succeeded to control js50: mode auto
$ cocoro info
[INFO][Cocoro] Device information
{'id': 123456, 'place': 'リビング', 'name': 'my js50', 'deviceType': 'AIR_CLEANER', 'zipCd': '7890123', 'yomi': '', 'lSubInfo': '{"room_data":{"size": 10.0, "struct": "prefab", "unit": "tatami"}}'}
$ cocoro info model --log_level=warning
KIJS50
$ cocoro info maker --log_level=warning
SHARP
Metadata
Release files for cocoro 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cocoro-0.1.6.tar.gz | 9.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cocoro-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / cocoro-0.1.6.tar.gz
| Download URL | cocoro-0.1.6.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
321a0567139113027f1513e701e546c322839ebb298d1e4066b019145acda36d
|
|
BLAKE2b-256 checksum How to use checksums |
ec4efa9f7701491796608c38434afe57e89a7b6b4a14a45e63d3e0fe041fb87a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.12 Darwin/24.6.0
|
Release files / cocoro-0.1.6-py3-none-any.whl
| Download URL | cocoro-0.1.6-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bbce8d95d98d455940246d92bf272d3f41a796f783279a80d9c2ffa6220396f
|
|
BLAKE2b-256 checksum How to use checksums |
9ebc15ed13459cdae4ec6061d506105259c879bd7936d4ae3b4fb46f15b82dc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.12 Darwin/24.6.0
|
Security for cocoro 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.