IRremoteESP8266
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
IRMideaAC Class Reference

Class for handling detailed Midea A/C messages. More...

#include <ir_Midea.h>

Collaboration diagram for IRMideaAC:
Collaboration graph
[legend]

Public Member Functions

 IRMideaAC (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
 Class constructor. More...
 
void stateReset (void)
 Reset the state of the remote to a known good state/sequence. More...
 
void send (const uint16_t repeat=kMideaMinRepeat)
 Send the current internal state as an IR message. More...
 
int8_t calibrate (void)
 Run the calibration to calculate uSec timing offsets for this platform. More...
 
void begin (void)
 Set up hardware to be able to send a message. More...
 
void on (void)
 Set the requested power state of the A/C to on. More...
 
void off (void)
 Set the requested power state of the A/C to off. More...
 
void setPower (const bool on)
 Change the power setting. More...
 
bool getPower (void) const
 Get the value of the current power setting. More...
 
bool getUseCelsius (void) const
 Is the device currently using Celsius or the Fahrenheit temp scale? More...
 
void setUseCelsius (const bool celsius)
 Set the A/C unit to use Celsius natively. More...
 
void setTemp (const uint8_t temp, const bool useCelsius=false)
 Set the temperature. More...
 
uint8_t getTemp (const bool useCelsius=false) const
 Get the current temperature setting. More...
 
void setSensorTemp (const uint8_t temp, const bool useCelsius=false)
 Set the Sensor temperature. More...
 
uint8_t getSensorTemp (const bool useCelsius=false) const
 Get the current Sensor temperature setting. More...
 
void setEnableSensorTemp (const bool on)
 Enable the remote's Sensor temperature. More...
 
bool getEnableSensorTemp (void) const
 Is the remote temperature sensor enabled? More...
 
void setFan (const uint8_t fan)
 Set the speed of the fan. More...
 
uint8_t getFan (void) const
 Get the current fan speed setting. More...
 
void setMode (const uint8_t mode)
 Set the operating mode of the A/C. More...
 
uint8_t getMode (void) const
 Get the operating mode setting of the A/C. More...
 
void setRaw (const uint64_t newState)
 Set the internal state from a valid code for this protocol. More...
 
uint64_t getRaw (void)
 Get a copy of the internal state/code for this protocol. More...
 
void setSleep (const bool on)
 Set the Sleep setting of the A/C. More...
 
bool getSleep (void) const
 Get the Sleep setting of the A/C. More...
 
bool isSwingVToggle (void) const
 Is the current state a vertical swing toggle message? More...
 
void setSwingVToggle (const bool on)
 Set the A/C to toggle the vertical swing toggle for the next send. More...
 
bool getSwingVToggle (void)
 
bool isSwingVStep (void) const
 Is the current state a step vertical swing message? More...
 
void setSwingVStep (const bool on)
 Set the A/C to step the vertical swing for the next send. More...
 
bool getSwingVStep (void)
 
bool isEconoToggle (void) const
 Is the current state an Econo (energy saver) toggle message? More...
 
void setEconoToggle (const bool on)
 Set the A/C to toggle the Econo (energy saver) mode for the next send. More...
 
bool getEconoToggle (void)
 
bool isTurboToggle (void) const
 Is the current state a Turbo toggle message? More...
 
void setTurboToggle (const bool on)
 Set the A/C to toggle the Turbo mode for the next send. More...
 
bool getTurboToggle (void)
 
bool isLightToggle (void) const
 Is the current state a Light (LED) toggle message? More...
 
void setLightToggle (const bool on)
 Set the A/C to toggle the Light (LED) mode for the next send. More...
 
bool getLightToggle (void)
 
bool isCleanToggle (void) const
 Is the current state a Self-Clean toggle message? More...
 
void setCleanToggle (const bool on)
 Set the A/C to toggle the Self Clean mode for the next send. More...
 
bool getCleanToggle (void)
 
bool is8CHeatToggle (void) const
 Is the current state a 8C Heat (Freeze Protect) toggle message? More...
 
void set8CHeatToggle (const bool on)
 Set the A/C to toggle the 8C Heat (Freeze Protect) mode for the next send. More...
 
bool get8CHeatToggle (void)
 
bool isQuiet (void) const
 Is the current state a Quiet(Silent) message? More...
 
void setQuiet (const bool on)
 Set the Quiet (Silent) mode for the next send. More...
 
void setQuiet (const bool on, const bool prev)
 Set the Quiet (Silent) mode for the next send. More...
 
bool getQuiet (void) const
 
uint8_t getType (void) const
 Get the message type setting of the A/C message. More...
 
bool isOnTimerEnabled (void) const
 Is the OnTimer enabled? More...
 
uint16_t getOnTimer (void) const
 Get the value of the OnTimer is currently set to. More...
 
void setOnTimer (const uint16_t mins)
 Set the value of the On Timer. More...
 
bool isOffTimerEnabled (void) const
 Is the OffTimer enabled? More...
 
uint16_t getOffTimer (void) const
 Get the value of the OffTimer is currently set to. More...
 
void setOffTimer (const uint16_t mins)
 Set the value of the Off Timer. More...
 
stdAc::state_t toCommon (const stdAc::state_t *prev=NULL)
 Convert the current internal state into its stdAc::state_t equivalent. More...
 
String toString (void)
 Convert the current internal state into a human readable string. More...
 

Static Public Member Functions

static bool validChecksum (const uint64_t state)
 Verify the checksum is valid for a given state. More...
 
static uint8_t convertMode (const stdAc::opmode_t mode)
 Convert a stdAc::opmode_t enum into its native mode. More...
 
static uint8_t convertFan (const stdAc::fanspeed_t speed)
 Convert a stdAc::fanspeed_t enum into it's native speed. More...
 
static stdAc::opmode_t toCommonMode (const uint8_t mode)
 Convert a native mode into its stdAc equivalent. More...
 
static stdAc::fanspeed_t toCommonFanSpeed (const uint8_t speed)
 Convert a native fan speed into its stdAc equivalent. More...
 

Private Member Functions

void checksum (void)
 Calculate & set the checksum for the current internal state of the remote. More...
 
void setType (const uint8_t type)
 Set the message type setting of the A/C message. More...
 

Static Private Member Functions

static uint8_t calcChecksum (const uint64_t state)
 Calculate the checksum for a given state. More...
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
MideaProtocol _
 
bool _CleanToggle
 
bool _EconoToggle
 
bool _8CHeatToggle
 
bool _LightToggle
 
bool _Quiet
 
bool _Quiet_prev
 
bool _SwingVToggle
 
bool _SwingVStep
 
bool _TurboToggle
 

Detailed Description

Class for handling detailed Midea A/C messages.

Warning
Consider this very alpha code.

Constructor & Destructor Documentation

◆ IRMideaAC()

IRMideaAC::IRMideaAC ( const uint16_t  pin,
const bool  inverted = false,
const bool  use_modulation = true 
)
explicit

Class constructor.

Parameters
[in]pinGPIO to be used when sending.
[in]invertedIs the output signal to be inverted?
[in]use_modulationIs frequency modulation to be used?

Member Function Documentation

◆ begin()

void IRMideaAC::begin ( void  )

Set up hardware to be able to send a message.

◆ calcChecksum()

uint8_t IRMideaAC::calcChecksum ( const uint64_t  state)
staticprivate

Calculate the checksum for a given state.

Parameters
[in]stateThe value to calc the checksum of.
Returns
The calculated checksum value.

◆ calibrate()

int8_t IRMideaAC::calibrate ( void  )
inline

Run the calibration to calculate uSec timing offsets for this platform.

Returns
The uSec timing offset needed per modulation of the IR Led.
Note
This will produce a 65ms IR signal pulse at 38kHz. Only ever needs to be run once per object instantiation, if at all.

◆ checksum()

void IRMideaAC::checksum ( void  )
private

Calculate & set the checksum for the current internal state of the remote.

◆ convertFan()

uint8_t IRMideaAC::convertFan ( const stdAc::fanspeed_t  speed)
static

Convert a stdAc::fanspeed_t enum into it's native speed.

Parameters
[in]speedThe enum to be converted.
Returns
The native equivalent of the enum.

◆ convertMode()

uint8_t IRMideaAC::convertMode ( const stdAc::opmode_t  mode)
static

Convert a stdAc::opmode_t enum into its native mode.

Parameters
[in]modeThe enum to be converted.
Returns
The native equivalent of the enum.

◆ get8CHeatToggle()

bool IRMideaAC::get8CHeatToggle ( void  )
Returns
true, the setting is on. false, the setting is off.

◆ getCleanToggle()

bool IRMideaAC::getCleanToggle ( void  )
Returns
true, the setting is on. false, the setting is off.

◆ getEconoToggle()

bool IRMideaAC::getEconoToggle ( void  )
Returns
true, the setting is on. false, the setting is off.

◆ getEnableSensorTemp()

bool IRMideaAC::getEnableSensorTemp ( void  ) const

Is the remote temperature sensor enabled?

Returns
A boolean indicating if it is enabled or not.
Note
Also known as FollowMe

◆ getFan()

uint8_t IRMideaAC::getFan ( void  ) const

Get the current fan speed setting.

Returns
The current fan speed.

◆ getLightToggle()

bool IRMideaAC::getLightToggle ( void  )
Returns
true, the setting is on. false, the setting is off.

◆ getMode()

uint8_t IRMideaAC::getMode ( void  ) const

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getOffTimer()

uint16_t IRMideaAC::getOffTimer ( void  ) const

Get the value of the OffTimer is currently set to.

Returns
The number of minutes.

◆ getOnTimer()

uint16_t IRMideaAC::getOnTimer ( void  ) const

Get the value of the OnTimer is currently set to.

Returns
The number of minutes.

◆ getPower()

bool IRMideaAC::getPower ( void  ) const

Get the value of the current power setting.

Returns
true, the setting is on. false, the setting is off.

◆ getQuiet()

bool IRMideaAC::getQuiet ( void  ) const
Returns
true, the setting is on. false, the setting is off.

◆ getRaw()

uint64_t IRMideaAC::getRaw ( void  )

Get a copy of the internal state/code for this protocol.

Returns
The code for this protocol based on the current internal state.

◆ getSensorTemp()

uint8_t IRMideaAC::getSensorTemp ( const bool  celsius = false) const

Get the current Sensor temperature setting.

Parameters
[in]celsiustrue, the results are in Celsius. false, in Fahrenheit.
Returns
The current setting for temp. in the requested units/scale.
Note
Also known as FollowMe

◆ getSleep()

bool IRMideaAC::getSleep ( void  ) const

Get the Sleep setting of the A/C.

Returns
true, the setting is on. false, the setting is off.

◆ getSwingVStep()

bool IRMideaAC::getSwingVStep ( void  )
Returns
true, the setting is on. false, the setting is off.

◆ getSwingVToggle()

bool IRMideaAC::getSwingVToggle ( void  )
Note
On Danby A/C units, this is associated with the Ion Filter instead.
Returns
true, the setting is on. false, the setting is off.

◆ getTemp()

uint8_t IRMideaAC::getTemp ( const bool  celsius = false) const

Get the current temperature setting.

Parameters
[in]celsiustrue, the results are in Celsius. false, in Fahrenheit.
Returns
The current setting for temp. in the requested units/scale.

◆ getTurboToggle()

bool IRMideaAC::getTurboToggle ( void  )
Returns
true, the setting is on. false, the setting is off.

◆ getType()

uint8_t IRMideaAC::getType ( void  ) const

Get the message type setting of the A/C message.

Returns
The message type setting.

◆ getUseCelsius()

bool IRMideaAC::getUseCelsius ( void  ) const

Is the device currently using Celsius or the Fahrenheit temp scale?

Returns
true, the A/C unit uses Celsius natively, false, is Fahrenheit.

◆ is8CHeatToggle()

bool IRMideaAC::is8CHeatToggle ( void  ) const

Is the current state a 8C Heat (Freeze Protect) toggle message?

Note
Only works in Heat mode.
Returns
true, it is. false, it isn't.

◆ isCleanToggle()

bool IRMideaAC::isCleanToggle ( void  ) const

Is the current state a Self-Clean toggle message?

Returns
true, it is. false, it isn't.

◆ isEconoToggle()

bool IRMideaAC::isEconoToggle ( void  ) const

Is the current state an Econo (energy saver) toggle message?

Returns
true, it is. false, it isn't.

◆ isLightToggle()

bool IRMideaAC::isLightToggle ( void  ) const

Is the current state a Light (LED) toggle message?

Returns
true, it is. false, it isn't.

◆ isOffTimerEnabled()

bool IRMideaAC::isOffTimerEnabled ( void  ) const

Is the OffTimer enabled?

Returns
true for yes, false for no.

◆ isOnTimerEnabled()

bool IRMideaAC::isOnTimerEnabled ( void  ) const

Is the OnTimer enabled?

Returns
true for yes, false for no.

◆ isQuiet()

bool IRMideaAC::isQuiet ( void  ) const

Is the current state a Quiet(Silent) message?

Returns
true, it is. false, it isn't.

◆ isSwingVStep()

bool IRMideaAC::isSwingVStep ( void  ) const

Is the current state a step vertical swing message?

Returns
true, it is. false, it isn't.

◆ isSwingVToggle()

bool IRMideaAC::isSwingVToggle ( void  ) const

Is the current state a vertical swing toggle message?

Note
On Danby A/C units, this is associated with the Ion Filter instead.
Returns
true, it is. false, it isn't.

◆ isTurboToggle()

bool IRMideaAC::isTurboToggle ( void  ) const

Is the current state a Turbo toggle message?

Returns
true, it is. false, it isn't.

◆ off()

void IRMideaAC::off ( void  )

Set the requested power state of the A/C to off.

◆ on()

void IRMideaAC::on ( void  )

Set the requested power state of the A/C to on.

◆ send()

void IRMideaAC::send ( const uint16_t  repeat = kMideaMinRepeat)

Send the current internal state as an IR message.

Parameters
[in]repeatNr. of times the message will be repeated.

◆ set8CHeatToggle()

void IRMideaAC::set8CHeatToggle ( const bool  on)

Set the A/C to toggle the 8C Heat (Freeze Protect) mode for the next send.

Note
Only works in Heat mode.
Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setCleanToggle()

void IRMideaAC::setCleanToggle ( const bool  on)

Set the A/C to toggle the Self Clean mode for the next send.

Note
Only works in Cool, Dry, or Auto modes.
Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setEconoToggle()

void IRMideaAC::setEconoToggle ( const bool  on)

Set the A/C to toggle the Econo (energy saver) mode for the next send.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setEnableSensorTemp()

void IRMideaAC::setEnableSensorTemp ( const bool  on)

Enable the remote's Sensor temperature.

Parameters
[in]ontrue, the setting is on. false, the setting is off.
Note
Also known as FollowMe

◆ setFan()

void IRMideaAC::setFan ( const uint8_t  fan)

Set the speed of the fan.

Parameters
[in]fanThe desired setting. 1-3 set the speed, 0 for auto.

◆ setLightToggle()

void IRMideaAC::setLightToggle ( const bool  on)

Set the A/C to toggle the Light (LED) mode for the next send.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setMode()

void IRMideaAC::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setOffTimer()

void IRMideaAC::setOffTimer ( const uint16_t  mins)

Set the value of the Off Timer.

Parameters
[in]minsThe number of minutes for the timer.
Note
Time will be rounded down to nearest 30 min as that is the resolution of the actual device/protocol.
A value of less than 30 will disable the Timer.

◆ setOnTimer()

void IRMideaAC::setOnTimer ( const uint16_t  mins)

Set the value of the On Timer.

Parameters
[in]minsThe number of minutes for the timer.
Note
Time will be rounded down to nearest 30 min as that is the resolution of the actual device/protocol.
A value of less than 30 will disable the Timer.
Warning
On Timer is incompatible with Sensor Temp/Follow Me messages. Setting it will disable that mode/settings.

◆ setPower()

void IRMideaAC::setPower ( const bool  on)

Change the power setting.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setQuiet() [1/2]

void IRMideaAC::setQuiet ( const bool  on)

Set the Quiet (Silent) mode for the next send.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setQuiet() [2/2]

void IRMideaAC::setQuiet ( const bool  on,
const bool  prev 
)

Set the Quiet (Silent) mode for the next send.

Parameters
[in]ontrue, the setting is on. false, the setting is off.
[in]prevtrue, previously the setting was on. false, setting was off.

◆ setRaw()

void IRMideaAC::setRaw ( const uint64_t  newState)

Set the internal state from a valid code for this protocol.

Parameters
[in]newStateA valid code for this protocol.

◆ setSensorTemp()

void IRMideaAC::setSensorTemp ( const uint8_t  temp,
const bool  useCelsius = false 
)

Set the Sensor temperature.

Parameters
[in]tempThe temperature in degrees celsius.
[in]useCelsiustrue, use the Celsius temp scale. false, is Fahrenheit
Note
Also known as FollowMe

◆ setSleep()

void IRMideaAC::setSleep ( const bool  on)

Set the Sleep setting of the A/C.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setSwingVStep()

void IRMideaAC::setSwingVStep ( const bool  on)

Set the A/C to step the vertical swing for the next send.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setSwingVToggle()

void IRMideaAC::setSwingVToggle ( const bool  on)

Set the A/C to toggle the vertical swing toggle for the next send.

Note
On Danby A/C units, this is associated with the Ion Filter instead.
Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setTemp()

void IRMideaAC::setTemp ( const uint8_t  temp,
const bool  useCelsius = false 
)

Set the temperature.

Parameters
[in]tempThe temperature in degrees celsius.
[in]useCelsiustrue, use the Celsius temp scale. false, is Fahrenheit

◆ setTurboToggle()

void IRMideaAC::setTurboToggle ( const bool  on)

Set the A/C to toggle the Turbo mode for the next send.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setType()

void IRMideaAC::setType ( const uint8_t  setting)
private

Set the message type setting of the A/C message.

Parameters
[in]settingThe desired message type setting.

◆ setUseCelsius()

void IRMideaAC::setUseCelsius ( const bool  on)

Set the A/C unit to use Celsius natively.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ stateReset()

void IRMideaAC::stateReset ( void  )

Reset the state of the remote to a known good state/sequence.

◆ toCommon()

stdAc::state_t IRMideaAC::toCommon ( const stdAc::state_t prev = NULL)

Convert the current internal state into its stdAc::state_t equivalent.

Parameters
[in]prevA Ptr to the previous state.
Returns
The stdAc equivalent of the native settings.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IRMideaAC::toCommonFanSpeed ( const uint8_t  speed)
static

Convert a native fan speed into its stdAc equivalent.

Parameters
[in]speedThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toCommonMode()

stdAc::opmode_t IRMideaAC::toCommonMode ( const uint8_t  mode)
static

Convert a native mode into its stdAc equivalent.

Parameters
[in]modeThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toString()

String IRMideaAC::toString ( void  )

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ validChecksum()

bool IRMideaAC::validChecksum ( const uint64_t  state)
static

Verify the checksum is valid for a given state.

Parameters
[in]stateThe state to verify the checksum of.
Returns
true, if the state has a valid checksum. Otherwise, false.

Member Data Documentation

◆ _

MideaProtocol IRMideaAC::_
private

◆ _8CHeatToggle

bool IRMideaAC::_8CHeatToggle
private

◆ _CleanToggle

bool IRMideaAC::_CleanToggle
private

◆ _EconoToggle

bool IRMideaAC::_EconoToggle
private

◆ _irsend

IRsend IRMideaAC::_irsend
private

Instance of the IR send class.

◆ _LightToggle

bool IRMideaAC::_LightToggle
private

◆ _Quiet

bool IRMideaAC::_Quiet
private

◆ _Quiet_prev

bool IRMideaAC::_Quiet_prev
private

◆ _SwingVStep

bool IRMideaAC::_SwingVStep
private

◆ _SwingVToggle

bool IRMideaAC::_SwingVToggle
private

◆ _TurboToggle

bool IRMideaAC::_TurboToggle
private

The documentation for this class was generated from the following files: