Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Currently supported Coffee Machine models include:
|Series | Model Number |
|-----------|---------------------|
|Series 2200| `EP2220`, `EP2235` |
|Series 3200| `EP3243`, `EP3246` |
|Series 3200| `EP3221`, `EP3243`, `EP3246` |

My modified `EP2220`:
![Modified Coffee Machine](images/machine_inside.jpg)
Expand All @@ -34,7 +34,7 @@ A example configuration can be found [here](example.yaml)
- **power_trip_delay**(**Optional**: Time): Determines the length of the power outage applied to the display unit, which is to trick it into turning on. Defaults to `500ms`.
- **power_message_repetitions**(**Optional**: uint): Determines how many message repetitions are used while turning on the machine. On some hardware combinations a higher value such as `25` is required to turn on the display successfully. Defaults to `5`.
- **language**(**Optional**: int): Status sensor language. Select one of `en-US`, `de-DE`, `it-IT`, `hu-HU`. Defaults to `en-US`.
- **model**(**Optional**: int): Different models or revisions may use different commands. This option can be used to specify the command set used by this component. Select one of `EP_2220`, `EP_2235`, `EP_3243`, `EP_3246`. Defaults to `EP_2220`.
- **model**(**Optional**: int): Different models or revisions may use different commands. This option can be used to specify the command set used by this component. Select one of `EP_2220`, `EP_2235`, `EP_3221`, `EP_3243`, `EP_3246`. Defaults to `EP_2220`.

## Philips Power switch

Expand All @@ -45,7 +45,7 @@ A example configuration can be found [here](example.yaml)
## Action Button

- **controller_id**(**Required**, string): The Philips Coffee Machine-Controller to which this entity belongs
- **action**(**Required**, int): The action performed by this button. Select one of `SELECT_COFFEE`, `MAKE_COFFEE`, `SELECT_ESPRESSO`, `MAKE_ESPRESSO`, `SELECT_HOT_WATER`, `MAKE_HOT_WATER`, `SELECT_STEAM`, `MAKE_STEAM`, `SELECT_CAPPUCCINO`, `MAKE_CAPPUCCINO`, `SELECT_LATTE`, `MAKE_LATTE`, `SELECT_AMERICANO`, `MAKE_AMERICANO`, `BEAN`, `SIZE`, `MILK`, `AQUA_CLEAN`, `CALC_CLEAN`, `PLAY_PAUSE`. Note that some options are only available on select models.
- **action**(**Required**, int): The action performed by this button. Select one of `SELECT_COFFEE`, `MAKE_COFFEE`, `SELECT_ESPRESSO`, `MAKE_ESPRESSO`, `SELECT_ESPRESSO_LUNGO`, `MAKE_ESPRESSO_LUNGO`,`SELECT_HOT_WATER`, `MAKE_HOT_WATER`, `SELECT_STEAM`, `MAKE_STEAM`, `SELECT_CAPPUCCINO`, `MAKE_CAPPUCCINO`, `SELECT_LATTE`, `MAKE_LATTE`, `SELECT_AMERICANO`, `MAKE_AMERICANO`, `BEAN`, `SIZE`, `MILK`, `AQUA_CLEAN`, `CALC_CLEAN`, `PLAY_PAUSE`. Note that some options are only available on select models.
- **long_press**(**Optional**, boolean): If set to `true` this button will perform a long press. This option is only available for actions which don't include `MAKE`.
- All other options from [Button](https://esphome.io/components/button/index.html#config-button)

Expand Down
1 change: 1 addition & 0 deletions components/philips_coffee_machine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
COMMAND_SETS = {
"EP_2220": "PHILIPS_EP2220",
"EP_2235": "PHILIPS_EP2235",
"EP_3221": "PHILIPS_EP3221",
"EP_3243": "PHILIPS_EP3243",
# Note that the EP3243 and EP3246 are identical except for cosmetic differences
"EP_3246": "PHILIPS_EP3243",
Expand Down
2 changes: 2 additions & 0 deletions components/philips_coffee_machine/button/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"MAKE_COFFEE": Action.MAKE_COFFEE,
"SELECT_ESPRESSO": Action.SELECT_ESPRESSO,
"MAKE_ESPRESSO": Action.MAKE_ESPRESSO,
"SELECT_ESPRESSO_LUNGO": Action.SELECT_ESPRESSO_LUNGO,
"MAKE_ESPRESSO_LUNGO": Action.MAKE_ESPRESSO_LUNGO,
"SELECT_HOT_WATER": Action.SELECT_HOT_WATER,
"MAKE_HOT_WATER": Action.MAKE_HOT_WATER,
"SELECT_STEAM": Action.SELECT_STEAM,
Expand Down
212 changes: 114 additions & 98 deletions components/philips_coffee_machine/button/action_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,116 +55,132 @@ namespace esphome
}
}

void ActionButton::execute_command(const std::vector<uint8_t> &command)
{
auto action = action_;

write_array(command);

if (
action == SELECT_COFFEE
|| action == SELECT_ESPRESSO
|| action == SELECT_ESPRESSO_LUNGO
|| action == SELECT_HOT_WATER
|| action == SELECT_STEAM
|| action == SELECT_CAPPUCCINO
|| action == SELECT_LATTE
|| action == SELECT_AMERICANO
) return;

delay(BUTTON_SEQUENCE_DELAY);
write_array(command_press_play_pause);

}

void ActionButton::perform_action()
{
auto action = action_;
// Coffee
if (action == SELECT_COFFEE || action == MAKE_COFFEE)
{
write_array(command_press_1);
if (action == SELECT_COFFEE)
return;

delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
// These are what the commands are mapped to.
// command[0] - Coffee
// command[1] - Espresso
// command[2] - Hot Water
// command[3] - Steam
// command[4] - Cappuccino
// command[5] - Latte
// command[6] - Americano
// command[7] - Espresso Lungo

// Espresso
if (action == SELECT_ESPRESSO || action == MAKE_ESPRESSO)
{
write_array(command_press_2);
if (action == SELECT_ESPRESSO)
return;
delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
// Default for most models
std::vector<uint8_t> command[8] {
command_press_1,
command_press_2,
command_press_3
};

// Hot water
if (action == SELECT_HOT_WATER || action == MAKE_HOT_WATER)
{
write_array(command_press_3);
if (action == SELECT_HOT_WATER)
return;
delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
// command additions and overrides for specific models
#ifdef PHILIPS_EP2220
command[3] = command_press_4;
#endif

#ifdef PHILIPS_EP2220
// Steam
if (action == SELECT_STEAM || action == MAKE_STEAM)
{
write_array(command_press_4);
if (action == SELECT_STEAM)
return;
delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
#endif
#ifdef PHILIPS_EP2235
// Cappuccino
if (action == SELECT_CAPPUCCINO || action == MAKE_CAPPUCCINO)
{
write_array(command_press_4);
if (action == SELECT_CAPPUCCINO)
return;
delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
#endif
#ifdef PHILIPS_EP3243
// Latte
if (action == SELECT_LATTE || action == MAKE_LATTE)
{
write_array(command_press_4);
if (action == SELECT_LATTE)
return;
delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
#ifdef PHILIPS_EP2235
command[4] = command_press_4;
#endif

// Americano
if (action == SELECT_AMERICANO || action == MAKE_AMERICANO)
{
write_array(command_press_5);
if (action == SELECT_AMERICANO)
return;
delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
#ifdef PHILIPS_EP3221
command[0] = command_press_5;
command[2] = command_press_4;
command[3] = command_press_3;
command[6] = command_press_6;
command[7] = command_press_1;
#endif

// Cappuccino
if (action == SELECT_CAPPUCCINO || action == MAKE_CAPPUCCINO)
{
write_array(command_press_6);
if (action == SELECT_CAPPUCCINO)
return;
delay(BUTTON_SEQUENCE_DELAY);
action = PLAY_PAUSE;
}
#endif
// press/play or subsequent press/play
if (action == PLAY_PAUSE)
write_array(command_press_play_pause);
else if (action == SELECT_BEAN)
// bean button
write_array(command_press_bean);
else if (action == SELECT_SIZE)
// size button
write_array(command_press_size);
#ifdef PHILIPS_EP3243
command[4] = command_press_6;
command[5] = command_press_4;
command[6] = command_press_5;
#endif

switch (action) {
case SELECT_COFFEE:
case MAKE_COFFEE:
execute_command(command[0]);
break;
case SELECT_ESPRESSO:
case MAKE_ESPRESSO:
execute_command(command[1]);
break;
case SELECT_HOT_WATER:
case MAKE_HOT_WATER:
execute_command(command[2]);
break;
case SELECT_STEAM:
case MAKE_STEAM:
execute_command(command[3]);
break;
case SELECT_CAPPUCCINO:
case MAKE_CAPPUCCINO:
execute_command(command[4]);
break;
case SELECT_LATTE:
case MAKE_LATTE:
execute_command(command[5]);
break;
case SELECT_AMERICANO:
case MAKE_AMERICANO:
execute_command(command[6]);
break;
case SELECT_ESPRESSO_LUNGO:
case MAKE_ESPRESSO_LUNGO:
execute_command(command[7]);
break;
case PLAY_PAUSE:
write_array(command_press_play_pause);
break;
case SELECT_BEAN:
write_array(command_press_bean);
break;
case SELECT_SIZE:
write_array(command_press_size);
break;
#if defined(PHILIPS_EP3243)
else if (action == SELECT_MILK)
// milk button
write_array(command_press_milk);
case SELECT_MILK:
write_array(command_press_milk);
break;
#endif
else if (action == SELECT_AQUA_CLEAN)
// aqua clean button
write_array(command_press_aqua_clean);
else if (action == SELECT_CALC_CLEAN)
// calc clean button
write_array(command_press_calc_clean);
else
ESP_LOGE(TAG, "Invalid Action provided!");
case SELECT_AQUA_CLEAN:
write_array(command_press_aqua_clean);
break;
case SELECT_CALC_CLEAN:
write_array(command_press_calc_clean);
break;
default:
ESP_LOGE(TAG, "Invalid Action provided!");
}

}


} // namespace philips_action_button
} // namespace philips_coffee_machine
} // namespace esphome
4 changes: 4 additions & 0 deletions components/philips_coffee_machine/button/action_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace esphome
MAKE_COFFEE,
SELECT_ESPRESSO,
MAKE_ESPRESSO,
SELECT_ESPRESSO_LUNGO,
MAKE_ESPRESSO_LUNGO,
SELECT_HOT_WATER,
MAKE_HOT_WATER,
SELECT_STEAM,
Expand Down Expand Up @@ -109,6 +111,8 @@ namespace esphome
*/
void press_action() override;

void execute_command(const std::vector<uint8_t> &command);

/**
* @brief Writes the button to uart or initializes loop based message sending
*
Expand Down
12 changes: 6 additions & 6 deletions components/philips_coffee_machine/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace esphome
{
#if defined(PHILIPS_EP2220) || defined(PHILIPS_EP2235)
#define USE_DEFAULT_PHILIPS_COMMAND_SET
#elif defined(PHILIPS_EP3243)
#elif defined(PHILIPS_EP3243) || defined(PHILIPS_EP3221)
// Note that the EP3243 and EP3246 are identical except for cosmetic differences
const uint8_t message_header[2] = {0xD5, 0x55};
const uint8_t led_off = 0x00;
Expand All @@ -27,22 +27,22 @@ namespace esphome
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x01, 0x00, 0x00, 0x39, 0x39};
const std::vector<uint8_t> command_press_play_pause =
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x00, 0x00, 0x01, 0x3D, 0x30};
/// @brief EP3243: Press Coffee Button
/// @brief EP3243: Press Coffee Button; EP3221: Press Espresso Lungo Button
const std::vector<uint8_t> command_press_1 =
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x08, 0x00, 0x00, 0x1D, 0x1E};
/// @brief EP3243: Press Espresso Button
const std::vector<uint8_t> command_press_2 =
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x02, 0x00, 0x00, 0x2D, 0x2F};
/// @brief EP3243: Press Hot water Button
/// @brief EP3243: Press Hot water Button; EP3221: Press Steam Button
const std::vector<uint8_t> command_press_3 =
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x39, 0x38};
/// @brief EP3243: Press Latte Button
/// @brief EP3243: Press Latte Button; EP3221: Press Hot water Button
const std::vector<uint8_t> command_press_4 =
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x10, 0x00, 0x00, 0x2D, 0x24};
/// @brief EP3243: Press Americano Button
/// @brief EP3243: Press Americano Button; EP3221: Press Coffee Button
const std::vector<uint8_t> command_press_5 =
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x20, 0x00, 0x00, 0x04, 0x15};
/// @brief EP3243: Press cappuccino Button
/// @brief EP3243: Press Cappuccino Button; EP3221: Press Americano Button
const std::vector<uint8_t> command_press_6 =
{0xD5, 0x55, 0x00, 0x01, 0x03, 0x00, 0x0E, 0x04, 0x00, 0x00, 0x05, 0x03};
const std::vector<uint8_t> command_press_bean =
Expand Down