TillFleisch / ESPHome-Philips-Smart-Coffee

ESPHome components which implement a Philips Series 2200/3200 Coffee Machine into HomeAssistant. Capable of brewing automatic coffee.
Other
164 stars 26 forks source link

Random behavior - not brewing and resetting itself for EP_3246 #83

Open p1ranha opened 3 days ago

p1ranha commented 3 days ago

Hi, I finally managed to receive your original assembled PCB from JLC today, and after mounting the connectors, I programmed the ESP.

The whole machine started behaving erratically, I am not even able to control it properly using the screen nor ESP commands. I have following config: philips_coffee_machine: display_uart: uart_display mainboard_uart: uart_mainboard power_pin: GPIO12 id: coffee_machine language: en-US model: EP_3246

It seems like reset cycle comes in after the grinding and when brewing starts. Nothing comes out to the glass.

After manually turning on the machine, it waits for selection. I select espresso and press play. It start grinding, espresso is lit and then after grinding, all the buttons get animation of the circle. No coffee actually came out.

In the log, I see following: 14:35:56 [D] [switch:055] 'Power': Sending state ON
14:36:00 [D] [text_sensor:064] 'Status': Sending state 'Preparing'
14:36:05 [D] [text_sensor:064] 'Status': Sending state 'Idle'
14:36:08 [D] [sensor:093] 'Service Interval Counter': Sending state 8.00000 count with 0 decimals of accuracy
14:36:11 [D] [sensor:093] 'Brew Count': Sending state 8.00000 count with 0 decimals of accuracy
14:36:14 [D] [text_sensor:064] 'Status': Sending state 'Espresso selected'
14:36:35 [D] [text_sensor:064] 'Status': Sending state 'Brewing Espresso'
14:36:53 [D] [text_sensor:064] 'Status': Sending state 'Preparing'
14:37:02 [D] [text_sensor:064] 'Status': Sending state 'Idle'

Since no espresso came out, I tried coffee by selecting coffee and pressing play: 14:37:06 | [D] | [text_sensor:064] | 'Status': Sending state 'Coffee selected' 14:37:08 | [D] | [sensor:093] | 'Service Interval Counter': Sending state 9.00000 count with 0 decimals of accuracy 14:37:11 | [D] | [sensor:093] | 'Brew Count': Sending state 9.00000 count with 0 decimals of accuracy 14:37:15 | [D] | [text_sensor:064] | 'Status': Sending state 'Preparing' 14:37:28 | [D] | [text_sensor:064] | 'Status': Sending state 'Idle' 14:38:08 | [D] | [sensor:093] | 'Service Interval Counter': Sending state 9.00000 count with 0 decimals of accuracy 14:38:11 | [D] | [sensor:093] | 'Brew Count': Sending state 9.00000 count with 0 decimals of accuracy

There was no coffee coming out, and after grinding the animated loop of all buttons went thru.

Then without pressing nothing, I see some button presses happening: 14:38:35 | [D] | [text_sensor:064] | 'Status': Sending state 'Hot water selected' | nothing was pressed 14:38:38 | [D] | [text_sensor:064] | 'Status': Sending state 'Cleaning' 14:38:45 | [D] | [text_sensor:064] | 'Status': Sending state 'Preparing' 14:38:53 | [D] | [switch:055] | 'Power': Sending state OFF 14:38:53 | [D] | [switch:055] | 'PowerWithClean': Sending state OFF 14:38:53 | [D] | [text_sensor:064] | 'Status': Sending state 'Off'

Any ideas what may be wrong? Anything I do, either using normal buttons or "make espresso" has the same loop: grinding, start brewing, reset (with button led animation) before anything comes out to the glass.

p1ranha commented 3 days ago

This is when I just press "select espresso" and wait in the ESPhome:

It marks as espresso selected, then after some time it starts brewing it, never actually outputs anything and then turns itself off.

14:51:57 [D] [switch:012] 'Power' Turning ON.
14:51:58 [W] [component:237] Component esphome.coroutine took a long time for an operation (500 ms).
14:51:58 [W] [component:238] Components should block for at most 30 ms.
14:51:58 [D] [philips_power_switch:089] Performed 1 power trip(s).
14:51:58 [D] [switch:055] 'Power': Sending state ON
14:51:58 [D] [switch:055] 'PowerWithClean': Sending state ON
14:51:59 [D] [text_sensor:064] 'Status': Sending state 'Preparing'
14:52:08 [D] [sensor:093] 'Service Interval Counter': Sending state 9.00000 count with 0 decimals of accuracy
14:52:10 [D] [text_sensor:064] 'Status': Sending state 'Idle'
14:52:10 [D] [button:010] 'Select Espresso' Pressed.
14:52:11 [D] [sensor:093] 'Brew Count': Sending state 9.00000 count with 0 decimals of accuracy
14:52:12 [D] [text_sensor:064] 'Status': Sending state 'Espresso selected'
14:52:18 [D] [text_sensor:064] 'Status': Sending state 'Brewing Espresso'
14:52:26 [D] [text_sensor:064] 'Status': Sending state 'Preparing'
14:52:40 [D] [text_sensor:064] 'Status': Sending state 'Idle'
14:52:47 [D] [text_sensor:064] 'Status': Sending state 'Hot water selected'
14:52:51 [D] [text_sensor:064] 'Status': Sending state 'Cleaning'
14:53:00 [D] [text_sensor:064] 'Status': Sending state 'Preparing'
14:53:06 [D] [switch:055] 'Power': Sending state OFF
14:53:07 [D] [switch:055] 'PowerWithClean': Sending state OFF
14:53:07 [D] [text_sensor:064] 'Status': Sending state 'Off'
p1ranha commented 3 days ago

and the yaml config:

substitutions:
  name: "philips-coffee-machine"
  friendly_name: "Coffee Machine"

esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"
  name_add_mac_suffix: true

  project:
    name: TillFleisch.ESPHome-Philips-Smart-Coffee
    version: "1.0"

esp8266:
  board: esp12e

logger:
  baud_rate: 0

api:

ota:
  platform: esphome
web_server:
  port: 80

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.3.192
    gateway: 192.168.3.1
    subnet: 255.255.255.0
  ap:
    ssid: "Philips Fallback Hotspot"
    password: !secret wifi_password

time:
  - platform: homeassistant
    id: homeassistant_time

globals:
  - id: service_interval_counter
    type: int
    restore_value: true
    #initial_value: '0'
  - id: brew_count
    type: int
    restore_value: true
    #initial_value: '0'  

captive_portal:

external_components:
  - source: github://TillFleisch/ESPHome-Philips-Smart-Coffee@main

uart:
  # UART connected to the mainboard
  - tx_pin: GPIO1
    rx_pin: GPIO3
    baud_rate: 115200
    id: uart_mainboard

  # UART connected to the display
  - tx_pin: GPIO15
    rx_pin: GPIO13
    baud_rate: 115200
    id: uart_display

philips_coffee_machine:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: coffee_machine
  language: en-US
  model: EP_3246

text_sensor:
  - platform: philips_coffee_machine
    controller_id: coffee_machine
    id: status
    name: "Status"
    on_value:
      then:
        - lambda: |-
            if (id(status).state.find("Brewing 2x") != std::string::npos) {
              id(brew_count) += 2;
              id(service_interval_counter) += 2;
            } else if (id(status).state.find("Brewing") != std::string::npos) {
              id(brew_count) += 1;
              id(service_interval_counter) += 1;
            }       
switch:
  - platform: philips_coffee_machine
    controller_id: coffee_machine
    name: "Power"
    clean: false
    icon: mdi:coffee-maker

  - platform: philips_coffee_machine
    controller_id: coffee_machine
    name: "PowerWithClean"
    icon: mdi:coffee-maker

button:
  - platform: restart
    name: $friendly_name Restart

  - platform: philips_coffee_machine
    controller_id: coffee_machine
    action: SELECT_COFFEE
    name: "Select Coffee"
    icon: mdi:coffee
  - platform: philips_coffee_machine
    controller_id: coffee_machine
    action: MAKE_COFFEE
    name: "Make Coffee"
    icon: mdi:coffee

  - platform: philips_coffee_machine
    controller_id: coffee_machine
    action: SELECT_ESPRESSO
    name: "Select Espresso" 
    icon: mdi:coffee
  - platform: philips_coffee_machine
    controller_id: coffee_machine
    action: MAKE_ESPRESSO
    name: "Make Espresso" 
    icon: mdi:coffee

  - platform: philips_coffee_machine
    controller_id: coffee_machine
    action: PLAY_PAUSE
    name: "Select play/pause"
    icon: mdi:play-pause

sensor:
  - platform: template
    name: "Service Interval Counter"
    lambda: |-
      return id(service_interval_counter);
    state_class: measurement
    unit_of_measurement: "count"
    accuracy_decimals: 0

  - platform: template
    name: "Brew Count"
    lambda: |-
      return id(brew_count);
    state_class: measurement
    unit_of_measurement: "count"
    accuracy_decimals: 0     
p1ranha commented 2 days ago

I also just checked, and it never even created a single coffee puck. I just see grinded coffee in the coffee waste bin. so it somehow resets between grinding and making a puck. I disconnected the board today, and the machine works fine.

quack3d commented 2 days ago

Can you show your wiring? I don't use a PCB but I had lots of erratic behaviour when I used an ESP8266. When I switched to ESP32 it worked fine.

p1ranha commented 2 days ago

I ordered the original PCB with all parts assembled, so there is not much special wiring i have done.

image

image

TillFleisch commented 2 days ago

Which coffee machine model do you have?

I disconnected the board today, and the machine works fine.

That's good, the PCB also looks good.

Unfortunately, I have not yet heard of this kind of behaviour and since this modification does not change the inner working of the machine it's unexpected to see this kind of mischievous behaviour.

This component assumes that the EP_3246 is the same as the EP_3243 as the commands have been proven to work on the EP_3246 before. It may be the case that your machine is different for some reason.

I would recommend starting with a minimal configuration to figure out which part causes problems. Use a minimal configuration (generated by ESPHome) and add the external component as well the UART config and the philips_coffee_machine component.

philips_coffee_machine:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: coffee_machine
  language: en-US
  model: EP_3246

This should not affect the machine, as the component is only forwarding messages in both directions. Please test if the erroneous behaviour persists (while the machine is idling/has a beverage selected). If this does not help, the following configuartion can simplify the setup even more. Use a minimal ESPHome configuration, add the UART config from above and use this UART MITM external component.

Please also make sure nothing external is affecting your setup (an automation in Home Assistant for instance). I would also like to point out that ESPHome restarts the ESP every 15 min. if it's not connected to HA or WiFi, which may cause problems.

This could also be a power-related issue. Does the machine beep in the above scenario? Does the LED on the ESP blink when the machine resets/aborts?