Hi there,
I want to sent a notification, when my coffeemachine finished with making me a coffee.
Unfortunately, the conditions are a bit more difficult than I thought - due to the fact how the whole integration works…
First thing to know - it is a HomeConnect device, and I am using the home connect alt integration from HACS - not the default HomeConnect integration (with which I could do the automation - but with way less information… and the default integration is not as comfortable as the alternate integration…
OK, back to the topic.
The rules for such an automation should be pretty straight forward:
- Check if program has finished
- Send a persistant notification.
Now to the more complex part:
- We do have a “Select Program” - with which I can decide, if I want a coffee, or an espresso, or what ever else the machine can do.
- We do have a Sensor “Active Program” - which does show the selected program.
- We do have a parameter to show if a program is running - the operation state…
When the machine is “idle” - means, no program is running, the “selected program” from the select option does show the current selected program (e.g. Coffee, Espresso, …)
The “Active Program” has the state “unknown”.
Now, when I start the machine, the “selected program” becomes unknown - but the active program will show what the machine is currently doing… (Coffee, Espresso,…)
The Operational State is “running”.
As soon, as the Operational state is switching to “finished” - I want to display a notification with the content of the “active program”…
BUT: just with switching the Operation State to finished, the active program becomes “unknown” - and the selected program becomes the value of your selection…
Now, I could display the ‘selected program’ instead of the active program - but this would mean, that the Selected program might have changed - and therefore, it COULD display the wrong value.
I’ve debuged my automation in a way - that I am checking for conditions (after getting no notifications for a while)… and the automation always failed for the check: “if active program NOT unknown”…
Anyone an idea, how I could get the value of the “active program” just before it switched to unknown?
Trigger:
Condition #1 (not “unavailable”)
Condition #2 (not “unkown”)
Condition #3 + #4 (not “CleaningOn” / “CleaningOff”)
Action: Do some translation and send the notification:
Automation YAML:
alias: "notification: Kaffee ist fertig"
description: ""
trigger:
- platform: state
entity_id:
- sensor.siemens_ti9578x1de_68a40e8445de_bsh_common_status_operationstate
to: BSH.Common.EnumType.OperationState.Finished
condition:
- condition: not
conditions:
- condition: state
entity_id: sensor.siemens_ti9578x1de_68a40e8445de_active_program
state: unavailable
alias: Test if not "unavailable"
- condition: not
conditions:
- condition: state
entity_id: sensor.siemens_ti9578x1de_68a40e8445de_active_program
state: unknown
alias: Test if not "unknown"
- condition: not
conditions:
- condition: state
entity_id: sensor.siemens_ti9578x1de_68a40e8445de_active_program
state: ConsumerProducts.CoffeeMaker.Program.CleaningModes.ApplianceOffRinsing
alias: Test if not "ApplianceOffRinsing"
- condition: not
conditions:
- condition: state
entity_id: sensor.siemens_ti9578x1de_68a40e8445de_active_program
state: ConsumerProducts.CoffeeMaker.Program.CleaningModes.ApplianceOnRinsing
alias: Test if not "ApplianceOnRinsing"
action:
- service: notify.persistent_notification
data:
title: Benachrichtigung von Siemens EQ.9
message: >-
{% set Enum_program_type =
states('sensor.siemens_ti9578x1de_68a40e8445de_active_program_program')
%} {% set Program = {
"ConsumerProducts.CoffeeMaker.Program.Beverage.CaffeLatte":
"Milchkaffee",
"ConsumerProducts.CoffeeMaker.Program.Beverage.Cappuccino": "Cappuccino",
"ConsumerProducts.CoffeeMaker.Program.Beverage.Coffee": "Caffè Crema",
"ConsumerProducts.CoffeeMaker.Program.Beverage.Espresso": "Espresso",
"ConsumerProducts.CoffeeMaker.Program.Beverage.EspressoDoppio": "Espresso doppio",
"ConsumerProducts.CoffeeMaker.Program.Beverage.EspressoMacchiato": "Espresso Macchiato",
"ConsumerProducts.CoffeeMaker.Program.Beverage.LatteMacchiato": "Latte Macchiato",
"ConsumerProducts.CoffeeMaker.Program.Beverage.MilkFroth": "Milchschaum",
"ConsumerProducts.CoffeeMaker.Program.Beverage.Ristretto": "Ristretto",
"ConsumerProducts.CoffeeMaker.Program.Beverage.WarmMilk": "Warme Milch",
"ConsumerProducts.CoffeeMaker.Program.Beverage.XLCoffee": "Kaffee XL",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.Americano": "Americano",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.BlackEye": "Black Eye",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.CafeAuLait": "Café au lait",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.CafeConLeche": "Café con leche",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.CafeCortado": "Café cortado",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.Cortado": "Cortado",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.DeadEye": "Dead Eye",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.Doppio": "Doppio",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.FlatWhite": "Flat White",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.Galao": "Galão",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.Garoto": "Garoto",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.GrosserBrauner": "Großer Brauner",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.Kaapi": "Kaapi",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.KleinerBrauner": "Kleiner Brauner",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.KoffieVerkeerd": "Koffie verkeerd",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.RedEye": "Red Eye",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.Verlaengerter": "Verlängerter",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.VerlaengerterBraun": "Verlängerter braun",
"ConsumerProducts.CoffeeMaker.Program.CoffeeWorld.WienerMelange": "Wiener Melange" } %}
{{ Program[Enum_program_type] if Enum_program_type in Program.keys() else states('sensor.siemens_ti9578x1de_68a40e8445de_selected_program') }} ist fertig.
mode: single
```