All Projects â†’ Elian0213 â†’ daikin-wrapper-websocket

Elian0213 / daikin-wrapper-websocket

Licence: GPL-3.0 License
A websocket server that wraps around the Daikin API 🧊

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to daikin-wrapper-websocket

homebridge-daikin-airbase
A Homebridge plugin for the Daikin Airbase WiFi module
Stars: ✭ 14 (-36.36%)
Mutual labels:  daikin
homebridge-daikin-local
Supports Daikin Air Conditioners on HomeBridge
Stars: ✭ 82 (+272.73%)
Mutual labels:  daikin
P1P2Serial
P1P2Serial library and P1P2Monitor program for low-level reading and writing Daikin/Rotex P1/P2 bus (based on Japanese Home Bus System), likely also for DIII-NET (F1/F2) bus, Mitsubishi M-Net bus, Toshiba TCC-Link, Hitachi H-link, Panasonic/Sanyo SIII-Net, Haier, York, ..
Stars: ✭ 91 (+313.64%)
Mutual labels:  daikin

Daikin API Wrapper

This was originally written for my Streamdeck Plugin that I made to control my AC with, but I figured it could be used in many use cases and applications.

API Explained

Please check this out, I made an attempt

Setup

Config

Copy config.example.json and rename it to config.json and change the IP to the IP of your Daikin AC

{
    "websocketPort": 3000,
    "daikinIP": "192.168.0.1"
}

Run

After that you need to install all the packages

$ yarn

After all that you can run the script by typing

$ yarn dev

Usage

const ws = new WebSocket('ws://localhost:3000');

// Global storage of AC data
let acData = {};

ws.onopen = () => {
  // Receive AC info on connect
  ws.send(JSON.stringify({ name: 'getInfo' }));
};

// Receive data
ws.onmessage = (data) => {
  const response = JSON.parse(data.data);

  switch (response.name) {
  case 'getInfo':
    // Update global AC info
    acData = response.data;
    break;
  default:
    console.log(response);
    break;
  }
};

// Toggle power
const togglePower = () => {
  acData.pow = acData.pow === '1' ? '0' : '1';
  ws.send(JSON.stringify({ name: 'setData', value: acData }));
};

// Turn power on/off, depending on the state of the AC
togglePower();

Install Node

You will need Node.js to run this script, you can download it below

Download here

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].