This is an API server with minimal functionality to control the air conditioner and is the wrapper for irrp.py which is part of the pigpio project.
Raspberry Pi 3 model B
Python 3.7.3
git clone https://github.com/JIIOryo/air_conditioner_api.git
cd air_conditioner_api
# install pigpio for python3
sudo apt install python3-pigpio -y
# pigpiod start
sudo systemctl enable pigpiod
sudo systemctl start pigpiod
# download irrp.py to project root path
curl http://abyz.me.uk/rpi/pigpio/code/irrp_py.zip | zcat > irrp.py
# pip install
pip3 install -r requirements.txt
# generate config file
cp config.json.template config.json
# run
python3 server.py
You need to connect the infrared LED to the GPIO set in config.json.
detail
{
"cool": {
"type": "object",
"properties": {
"temperature": {
"type": "number",
"minimum": 16,
"maximum": 31,
"description": "Degree celsius of airflow from air conditioner."
},
"airflowLevel": {
"type": "string",
"enum": ["a", "1", "2", "3"],
"description": "Level of airflow from air conditioner. a: auto, 1: low, 2: middle, 3: high"
}
},
"required": [
"temperature",
"airflowLevel"
]
}
}
application/json
{
"temperature": 26,
"airflowLevel": "1"
}
{
"temperature": 23,
"airflowLevel": "a"
}
application/json
{
"code": 200,
"message": "ok"
}
{
"code": 400,
"error": "ValidationError",
"message": "Validation error ..."
}
detail
{
"hot": {
"type": "object",
"properties": {
"temperature": {
"type": "number",
"minimum": 16,
"maximum": 31,
"description": "Degree celsius of airflow from air conditioner."
},
"airflowLevel": {
"type": "string",
"enum": [
"a",
"1",
"2",
"3"
],
"description": "Level of airflow from air conditioner. a: auto, 1: low, 2: middle, 3: high"
}
},
"required": [
"temperature",
"airflowLevel"
]
}
}
application/json
{
"temperature": 26,
"airflowLevel": "1"
}
{
"temperature": 23,
"airflowLevel": "a"
}
application/json
{
"code": 200,
"message": "ok"
}
{
"code": 400,
"error": "ValidationError",
"message": "Validation error ..."
}
detail
{
"dehumidify": {
"type": "object",
"properties": {
"dehumidificationLevel": {
"type": "number",
"minimum": 1,
"maximum": 3,
"description": "Level of dehumidification by air conditioner. 1: low, 2: middle, 3: high"
},
"airflowLevel": {
"type": "string",
"enum": [
"a",
"1",
"2",
"3"
],
"description": "Level of airflow from air conditioner. a: auto, 1: low, 2: middle, 3: high"
}
},
"required": [
"dehumidificationLevel",
"airflowLevel"
]
}
}
application/json
{
"dehumidificationLevel": 1,
"airflowLevel": "2"
}
{
"dehumidificationLevel": 3,
"airflowLevel": "a"
}
application/json
{
"code": 200,
"message": "ok"
}
{
"code": 400,
"error": "ValidationError",
"message": "Validation error ..."
}
detail
None
application/json
None
application/json
{
"code": 200,
"message": "ok"
}
detail
None
application/json
None
application/json
{
"code": 200,
"message": "ok"
}