I have a “dumb” coffee machine with a push button to turn on and push again to turn off. This is a momentary switch, ideal for a relay: on for 500ms, off event.
I have wired a ESP8266 relay switch in parallel with the physical button.
This works fine, when I interface with Home Assistant to switch the relay, the device turns on or off.
I have an automation that updates the value of an input_boolean to determine when the relay was triggered.
The relay has: on, wait 500ms, turn off action.
Without this input_boolean I cannot determine the state of the last relay event. So therefore this input_boolean is the interface into HA that triggers the relay (instead of the relay updating the input_boolean).
But how can I determine, in HA, if the physical button is pressed, instead of the relay triggered?
This is the automation code that switch the relay on, from the input_boolean:
alias: Gaggia_power_State_set
description: Set the state of Gaggia Power when switch turns on
triggers:
- trigger: state
entity_id:
- input_boolean.gaggia_power_state
from: "off"
to: "on"
conditions: []
actions:
- type: turn_on
device_id: b60d580ea9e63f9f4be237412f2dc103
entity_id: 533c257cc4fc84472eb05f7899154d33
domain: switch
- action: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.gaggia_power_state
mode: single
What voltage is running on the switch circuit? You would need to monitor this on the load side of the switch and take that to an input on the ESP (using appropriate isolation for whatever the voltage is).
I am not sure what the voltage is- I will have to open the coffee machine up to measure the voltage around the switch when it turns on. The switch is mounted directly onto a PCBoard, so it is a little tricky. Also - not sure how to setup the physical switch in the circuit for the ESP input: Should it be in series with the relay switch’s NC side?
In that case, I will probably have to cut into the line that supply the signal to the switch.
I also have decided to move away from a relay but instead use optocouplers to get the same result. I am busy testing it on my test-bench outside of the coffee machine to see if I can simulate the process, before I move it in.
I have started to test on this optocoupler and it seems to be working. It will be almost the same size as the current dual-relay setup I have in the machine, once I cut off the terminals on both sides and solder the wires directly onto it.
I just need to get the ‘input’ side to work for the physical power switch.
Can you please point me to where I can find out more about “current sensor of voltage sensing through some level shifting”
Or some examples I can try out?
I really don’t know what to suggest with the information you have provided.
One can choose to use power monitor plug, or Shelly PM, Shelly EM or just a current sensor like ACS712 together with Esp. Or you can study the DC voltage levels of the circuit board and find some point where you can easily get DC voltage trigger. You can feed that to Esp through level shifter, voltage divider or optocoupler etc.
Most coffe machines have a LED or a bulb that is on when on.
Perhaps this can be sensed?
Or slightly more complex but a Dallas sensor to measure the temperature of the plate from below.
Obviously this will give a slight delay on, and a rather long delay off but it should work.
Phototransistor detecting LED is excellent choice to get trigger in case one doesn’t want to touch to devices electronics. Only minus side is esthetical (I don’t expect coffee maker having LEDs inside on the control board).
There could be enough light on the inside to trigger on depending on how its positioned.
Or just solder on wires on the poles and you have a ESP friendly voltage to use.
If the voltage is too low then just use an opto coupler to “boost” the voltage.
nope there is no ‘hot plate’ like with the older drip coffee machines, This is a grinding/brewing machine and everything is mostly internal. I guess I can go dig in deeper to find the thermostat, etc - but that is a little above my pay grade.
There are no LEDs on this board, it has a 2.5 LCD display that turns on. I do not know the specs of this LCD.
Correction: (I typed too soon): There is one red LED on the board that blinks slowly on-off, when the device is in standby mode.
When the device is powered on, LCD display turns on and LED turns off. It stays off until the power button is pressed again and then return to a blinking status.
It has a total of 7 buttons. I only currently have relays connected to the power button and the top left button, for Espresso. I do not see the need to control the other buttons, as one has to interface with the device anyway.
I mainly want to turn it on and off remotely as it takes about 45seconds to heat up and to clear the water pipes, before it is ready for brewing.
My apologies if this picture is not very clear.