Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
r45635 authored Mar 24, 2018
2 parents 28c024d + 321d435 commit 06ec60d
Show file tree
Hide file tree
Showing 10 changed files with 758 additions and 17 deletions.
47 changes: 36 additions & 11 deletions HVACDemo/IRremote2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,13 @@ void IRsend::sendHvacMitsubishiFD(
// Byte 6 - Mode
switch (HVAC_Mode)
{
case HVAC_HOT: data[6] = (byte) 0x00001000; break;
case HVAC_COLD: data[6] = (byte) 0x00011000; break;
case HVAC_DRY: data[6] = (byte) 0x00010000; break;
case HVAC_AUTO: data[6] = (byte) 0x00100000; break;
case HVAC_HOT: data[6] = (byte) B00001000; break;
case HVAC_COLD: data[6] = (byte) B00011000; break;
case HVAC_DRY: data[6] = (byte) B00010000; break;
case HVAC_AUTO: data[6] = (byte) B00100000; break;
default: break;
}
if (HVAC_ISEE) { data[6] = (byte) data[6] | 0x01000000; }
if (HVAC_ISEE) { data[6] = (byte) data[6] | B01000000; }

// Byte 7 - Temperature
// Check Min Max For Hot Mode
Expand All @@ -706,15 +706,24 @@ void IRsend::sendHvacMitsubishiFD(
// Byte 8 - Complement To HVAC Mode + Wide Vanne
switch (HVAC_Mode)
{
case HVAC_HOT: data[8] = (byte) 0x00000000; break;
case HVAC_COLD: data[8] = (byte) 0x00000000; break;
case HVAC_DRY: data[8] = (byte) 0x00000000; break;
case HVAC_AUTO: data[8] = (byte) 0x00000000; break;
case HVAC_HOT: data[8] = (byte) B00000000; break;
case HVAC_COLD: data[8] = (byte) B00000110; break;
case HVAC_DRY: data[8] = (byte) B00000010; break;
case HVAC_AUTO: data[8] = (byte) B00000000; break;
default: break;
}
switch (HVAC_WideMode)
{
case WIDE_LEFT_END: data[8] = (byte) data[8] | B00010000; break;
case WIDE_LEFT: data[8] = (byte) data[8] | B00100000; break;
case WIDE_MIDDLE: data[8] = (byte) data[8] | B00110000; break;
case WIDE_RIGHT: data[8] = (byte) data[8] | B01000000; break;
case WIDE_RIGHT_END: data[8] = (byte) data[8] | B01010000; break;
case WIDE_SWING: data[8] = (byte) data[8] | B10000000; break;
default: break;
}


// Byte 10 - FAN / VANNE
// Byte 9 - FAN / VANNE
switch (HVAC_FanMode)
{
case FAN_SPEED_1: data[9] = (byte) B00000001; break;
Expand All @@ -739,6 +748,22 @@ void IRsend::sendHvacMitsubishiFD(
default: break;
}

// Byte 13 - AREA MODE
switch (HVAC_AreaMode)
{
case AREA_SWING: data[13] = (byte) B00000000; break;
case AREA_LEFT: data[13] = (byte) B01000000; break;
case AREA_AUTO: data[13] = (byte) B10000000; break;
case AREA_RIGHT: data[13] = (byte) B11000000; break;
default: break;
}

// Byte 14 - CLEAN MODE
if (HVAC_CLEAN_MODE) { data[14] = (byte) B00000100; }

// Byte 15 - PLASMA
if (HVAC_PLASMA) { data[15] = (byte) B00000100; }

// Byte 18 - CRC
data[17] = 0;
for (i = 0; i < 17; i++) {
Expand Down
11 changes: 6 additions & 5 deletions HVACDemo/IRremote2.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ typedef enum HvacWideVanneMode {
WIDE_LEFT,
WIDE_MIDDLE,
WIDE_RIGHT,
WIDE_RIGHT_END
WIDE_RIGHT_END,
WIDE_SWING
} HvacWideVanneMode_t; // HVAC WIDE VANNE MODE

typedef enum HvacAreaMode {
Expand Down Expand Up @@ -201,10 +202,10 @@ class IRsend
int HVAC_SWITCH // Example false
);
void sendHvacToshiba(
HvacMode HVAC_Mode, // Example HVAC_HOT
int HVAC_Temp, // Example 21 (°c)
HvacFanMode HVAC_FanMode, // Example FAN_SPEED_AUTO
int OFF // Example false
HvacMode HVAC_Mode, // Example HVAC_HOT
int HVAC_Temp, // Example 21 (°c)
HvacFanMode HVAC_FanMode, // Example FAN_SPEED_AUTO
int OFF // Example false
);

void sendJVC(unsigned long data, int nbits, int repeat); // *Note instead of sending the REPEAT constant if you want the JVC repeat signal sent, send the original code value and change the repeat argument from 0 to 1. JVC protocol repeats by skipping the header NOT by sending a separate code value like NEC does.
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#HVAC IR Control

##Introduction
*HVAC IR Control aims to facilitate control of your HVAC emulating the IR code from an Arduino. The Do It Your Self has no limitation except the time to spent on it. I hope this repository can accelerate your development espcecially if you use Mitsubishi HVAC. Panasonic HVAC support has been added too thanks to another contributor. Should you wants to add another protocol data information releated to new brand or model then feel free to contact us*
*HVAC IR Control aims to facilitate control of your HVAC emulating the IR code from an Arduino (a python port for the RPI is also available). The Do It Your Self has no limitation except the time to spent on it. I hope this repository can accelerate your development espcecially if you use Mitsubishi HVAC. Panasonic HVAC support has been added too thanks to another contributor. Should you wants to add another protocol data information releated to new brand or model then feel free to contact us*

##Project background
I started to use sketch with an Arduino associated to IR emitter and IR Receiver. radpidly i stated that library available do not covers HVAC modules. A way to progress was to use a software named AnalysIR, therefore i ordered a license for this tool. Indeed this tool was perfectly doing the job of identifying the IR trame my IR remote was sending. Nevertheless, even if the data collected was able to identify bits values, the packet of data provided to use with the different existing libraries was a set of mark and space interger values. For an Arduino it's a lot of data only for one command to process in IR. Due to this limitation of memory, i started to think about coding a function using the Hex values of the trame decoded by AnalysisIR instead of having to manage mark & space huge array of data. Without AnalysisIR software, it never have been possible for me to achieve what i did. Thanks Chris ;).
Expand Down Expand Up @@ -42,6 +42,26 @@ void sendHvacMitsubishiFD(
```
Functions confirmed in MSZ-GE and MFZ modules from Mitsubishi.

<table>
<tbody>
<tr>
<td align="center">
<a href="https://github.com/Ericmas001" target="_blank">
Ericmas001 <br />
<img src="https://avatars1.githubusercontent.com/u/11448087?v=3&s=80" alt="Ericmas001" width=50 />
</a>
</td>
<td align="left">
<div class="nuget-badge">
<b>A python port has been made to be compatible with Raspberry Pi.</b> <br />
<code>pip install git+https://github.com/Ericmas001/HVAC-IR-Control</code> <br />
Big thanks to <a href="https://github.com/r45635" target="_blank">r45635</a>, <a href="https://github.com/bschwind" target="_blank">bschwind</a>, <a href="https://github.com/r45635" target="_blank">danijelt</a> who made this possible to achieve !
</div>
</td>
</tr>
</tbody>
</table>

## Panasonic HVAC

the function to send configuration is
Expand Down
2 changes: 2 additions & 0 deletions python/.pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Maximum number of characters on a single line.
max-line-length=900
32 changes: 32 additions & 0 deletions python/demo_mitsu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/python

"""
Demo Mitsubishi HVAC
"""
import time
import datetime
from hvac_ircontrol.ir_sender import LogLevel
from hvac_ircontrol.mitsubishi import Mitsubishi, ClimateMode, FanMode, VanneVerticalMode, VanneHorizontalMode, ISeeMode, AreaMode, PowerfulMode

if __name__ == "__main__":
while True:
print("=======================================================")
print("Power OFF")
HVAC = Mitsubishi(23, LogLevel.ErrorsOnly)
HVAC.power_off()
print("Wait 2 secs ...")
time.sleep(2)
print("It's gonna get cold here !")
HVAC.send_command(
climate_mode=ClimateMode.Cold,
temperature=18,
fan_mode=FanMode.Auto,
vanne_vertical_mode=VanneVerticalMode.Auto,
vanne_horizontal_mode=VanneHorizontalMode.NotSet,
isee_mode=ISeeMode.ISeeOn,
area_mode=AreaMode.Full,
powerful=PowerfulMode.PowerfulOn
)
print("=======================================================")
print("Go dormant for 30 secs ...")
time.sleep(25)
5 changes: 5 additions & 0 deletions python/hvac_ircontrol/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__import__('pkg_resources').declare_namespace(__name__)
from .version import __version__

from .ir_sender import *
from .mitsubishi import *
Loading

0 comments on commit 06ec60d

Please sign in to comment.