GithubHelp home page GithubHelp logo

sighmon / homekit-daikin-infrared Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 524 KB

An Apple HomeKit accessory for an infrared Daikin FTXS50KAVMA reverse cycle air conditioner, and Dyson Hot + Cold AM09 remote control heater.

License: MIT License

Python 15.65% Go 84.35%
go raspberrypi golang infrared daikin dyson heater aircon

homekit-daikin-infrared's Introduction

HomeKit Daikin/Dyson infrared accessory

An Apple HomeKit accessory for an infrared remote controller.

Currently supporting:

  • Daikin FTXS50KAVMA reverse cycle air conditioner
  • Dyson Hot + Cool AM09 fan heater

The accessory added to iOS

Hardware

  • Duinotech infrared receiver XC-4427 (Jaycar)
  • Duinotech infrared transmitter XC-4426 (Jaycar)

Optional temperature sensor

If you'd like to get feedback in the Apple Home app of the current room temperature, add a DHT22 sensor.

Note: for wiring and software of the DHT22, see this branch: add/1-dht22-temperature-sensor

Wiring

Raspberry Pi pin Infrared receiver pin
9 Ground -
11 GPIO17 s
17 3.3V middle
Raspberry Pi pin Infrared transmitter pin
14 Ground -
12 GPIO18 s
01 3.3V middle

Software

  • Install LIRC: sudo apt install lirc
  • Copy the Daikin configuration codes file: sudo cp codes/daikin.lircd.conf /etc/lirc/lircd.conf.d/
  • Restart LIRCd: sudo systemctl restart lircd
  • Build the HomeKit executable: go build homekit-daikin-infrared.go
  • Run the executable: ./homekit-daikin-infrared or run the go file directly go run homekit-daikin-infrared.go
  • In the Home app on your iOS device, add a new accessory with the code: 00102003
  • To control a Dyson Hot + Cool AM09 fan heater, run with the -dyson flag: go run homekit-daikin-infrared.go -dyson

LIRC

To detect IR codes, run: mode2

If pressing your remote doesn't output anything, try: mode2 --driver default

You can also set this as a default by editing /etc/lirc/lirc_options.conf

# /etc/lirc/lirc_options.conf
driver = default
device = /dev/lirc0

If you install both the decoder and transmitter, the devices will appear:

  • Transmitter: /dev/lirc0
  • Decoder: /dev/lirc1

Decoding Daikin IR codes

Find my collection of Daikin FTXS50KAVMA infrared codes in the /codes/daikin folder.

This was the process to create these text files:

  • Run: mode2 --driver default > power_on.txt
  • Press the power on button on your remote once
  • <control> + c to quit

I modified Ben's code a little to convert those LIRC pulse widths into binary strings.

Find the decoder at /codes/decode.py:

  • Run: python3 decode.py power_on.txt

Sample output: 00000BA1000100001011011111001000000000010100011000000000000000011101011BA1000100001011011111001000000000001000010000010011101110011111000BA10001000010110111110010000000000000000001001001001001100000000000000010100000000000000000110000000000110000000000000000010000011000000000000000000101010E

Where:

  • A = start of line
  • B = end of line
  • E = end of command

If you'd like to create a remote control codes file *.lircd.conf of your own, here are some instructions:

  • Run mode2 with column display mode on: mode2 --driver default -d /dev/lirc1 -m
  • Remove the end of line/start of line/end of command output (including the last pulse)
  • Copy it inbetween begin raw_codes and end raw_codes with a header name YOUR_COMMAND_NAME

Daikin FTXS50KAVMA IR codes

Here are the hex codes from the binary strings decode.py output:

# Power on

00 00
88 5B E4 00 A3 00 00 EB
88 5B E4 00 42 09 DC F8
11 0B 7C 80 00 12 49 80 00 A0 00 0C 00 C0 00 10 60 00 05
# Power off

00 00
88 5B E4 00 A3 00 00 EB
88 5B E4 00 42 A9 DC 24
11 0B 7C 80 00 02 49 80 00 A0 00 0C 00 C0 00 10 60 00 19
# Temperature up

00 00
88 5B E4 00 A3 00 00 EB
88 5B E4 00 42 E9 DC 64
11 0B 7C 80 00 02 45 80 00 A0 00 0C 00 C0 00 10 60 00 15
# Temperature down

00 00
88 5B E4 00 A3 00 00 EB
88 5B E4 00 42 19 DC E4
11 0B 7C 80 00 02 49 80 00 A0 00 0C 00 C0 00 10 60 00 19

The lengths seem to match these reversed Daikin codes for a ARC470A1 remote.

Sending IR codes

There's a sample LIRC config file: /codes/daikin/daikin.lircd.conf

The POWER_ON command sets the heating/cooling mode auto, fan mode auto, temperature 23.

There are individual temperature commands also with the mode auto, fan mode auto, e.g. TEMPERATURE_AUTO_18

This avoids having to deal with generating a dynamic .conf file for now.

  • Copy it to the right location: sudo cp codes/daikin/daikin.lircd.conf /etc/lirc/lircd.conf.d/
  • Restart LIRCd: sudo systemctl restart lircd
  • Send your command: irsend SEND_ONCE daikin POWER_ON

Sending also works via the Go LIRC client: /infrared-send/infrared-send.go

  • Modify your command in: infrared-send.go
  • Send it: go run infrared-send.go

TODO

  • Decode IR codes for all of the functions we'd like to use
  • Send those IR codes using the Go LIRC client
  • Setup HAP Go library to send IR codes
  • Add a DHT22 temperature sensor to get the current temperature (see add/1-dht22-temperature-sensor)
  • Write Go struct to programmatically create and send IR codes
  • Setup GAP Go library to receive air conditioner commands

Useful links

homekit-daikin-infrared's People

Contributors

sighmon avatar

Watchers

 avatar  avatar

homekit-daikin-infrared's Issues

Add DHT22 room temperature sensor

  • Add DHT22 room temperature sensor

Notes

  1. Try adding it directly (would this need to be run as root then?)
  2. Read temperature from Prometheus output?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.