Utilities to use Sharp, COCORO API
Project description
cocoro
Tools for COCORO API (SHARP products).
Install
Using pip
$ pip install cocoro
$ cocoro <cmd>
Using source code
Use poetry to setup the environment.
$ pip install poetry
$ git clone https://github.com/rcmdnk/cocoro.git
$ cd cocoro
$ poetry install
$ poetry run cocoro <cmd>
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:
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*************>
How to use
$ cocoro <cmd>
Available commands are:
on
: Switch onoff
: Switch offhumi_on
: Humidification onhumi_off
: Humidification offmode_auto
: Set mode: Automode_sleep
: Set mode: Sleepmode_pollen
: Set mode: Pollenmode_quiet
: Set mode: Quietmode_medium
: Set mode: Mediummode_high
: Set mode: Highmode_recommendation
: Set mode: Recommendationmode_effective
: Set mode: Effectiveversion
: Show version
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.