For inspiration: Meal plan
What about a meal plan? Ofcourse there’s the grocy addon. However, this was far too complicated and not scoring that high points on the WAF for just a meal plan. For this usecase I want to ask Google what’s for dinner today or tomorrow. Besides that also just look in HA at my Phone and see in a glance what we’ll be eating tonight. HA has already the helpers there but never thought this would be this usefull in this case.
If you copy this, make sure the ID of the entities all match up together. In the examples they don’t match!
So, for this I created in HA:
- 7 input_texts: input_text.monday, input_text.tuesday etc. (the ‘database’)
- 2 input booleans: input_boolean.what_eat_today and input_boolean.what_eat_tomorrow (to trigger the automations for google)
- Template sensor for the right day of the week
Code for the template sensor:
- platform: template
day:
friendly_name: Dag
value_template: "{{ ['Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag','Zondag'][now().weekday()] }}"
I do most of my automations in NR. Here’s the flow. But I’m sure this could also be achieved in HA. The broadcast message is in dutch
It might not be the most cleanish flow, but it works for me.
[{"id":"c380e0f0.3d8dc","type":"tab","label":"Dinner tts","disabled":false,"info":""},{"id":"e8ca6471.265f58","type":"server-state-changed","z":"c380e0f0.3d8dc","name":"WEWV aan","server":"d995232e.42f06","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.wat_eten_we_vandaag","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":110,"y":180,"wires":[["7804ccff.871b84"],[]]},{"id":"12d2374a.d3b1e9","type":"switch","z":"c380e0f0.3d8dc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Maandag","vt":"str"},{"t":"eq","v":"Dinsdag","vt":"str"},{"t":"eq","v":"Woensdag","vt":"str"},{"t":"eq","v":"Donderdag","vt":"str"},{"t":"eq","v":"Vrijdag","vt":"str"},{"t":"eq","v":"Zaterdag","vt":"str"},{"t":"eq","v":"Zondag","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":490,"y":180,"wires":[["a16f675b.744b38"],["e212603.de57ca"],["7e709dc6.517f54"],["78c70f72.b4c83"],["4c0119c1.1f0a08"],["559e5ce.6391da4"],["b5d866a1.ed7d58"]]},{"id":"7804ccff.871b84","type":"api-current-state","z":"c380e0f0.3d8dc","name":"Welke dag is het?","server":"d995232e.42f06","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.day","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":290,"y":180,"wires":[["12d2374a.d3b1e9","3af4db4b.475034"]]},{"id":"1f89844d.37a90c","type":"api-call-service","z":"c380e0f0.3d8dc","name":"tts broadcast","server":"d995232e.42f06","version":1,"debugenabled":false,"service_domain":"notify","service":"ga_broadcast","entityId":"","data":"{\"message\":\"Vandaag eten we {{payload}} \"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":890,"y":160,"wires":[[]]},{"id":"e212603.de57ca","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template dinsdag","server":"d995232e.42f06","template":"{{ states('input_text.dinsdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":670,"y":160,"wires":[["1f89844d.37a90c"]]},{"id":"a16f675b.744b38","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template maandag","server":"d995232e.42f06","template":"{{ states('input_text.maandag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":670,"y":120,"wires":[["1f89844d.37a90c"]]},{"id":"7e709dc6.517f54","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template woensdag","server":"d995232e.42f06","template":"{{ states('input_text.woensdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":670,"y":200,"wires":[["1f89844d.37a90c"]]},{"id":"b5666712.2db558","type":"server-state-changed","z":"c380e0f0.3d8dc","name":"WEWM aan","server":"d995232e.42f06","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.wat_eten_we_morgen","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":70,"y":640,"wires":[["a81b429f.2ba86"],[]]},{"id":"a81b429f.2ba86","type":"api-current-state","z":"c380e0f0.3d8dc","name":"Welke dag is het?","server":"d995232e.42f06","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.day","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":250,"y":640,"wires":[["69b2abb5.5bb094","ef2fa60b.dcad08"]]},{"id":"69b2abb5.5bb094","type":"api-call-service","z":"c380e0f0.3d8dc","name":"WEWM Uit","server":"d995232e.42f06","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.wat_eten_we_morgen","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":290,"y":740,"wires":[[]]},{"id":"3af4db4b.475034","type":"api-call-service","z":"c380e0f0.3d8dc","name":"WEWV Uit","server":"d995232e.42f06","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.wat_eten_we_vandaag","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":350,"y":260,"wires":[[]]},{"id":"78c70f72.b4c83","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template donderdag","server":"d995232e.42f06","template":"{{ states('input_text.donderdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":680,"y":240,"wires":[["1f89844d.37a90c"]]},{"id":"4c0119c1.1f0a08","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template Vrijdag","server":"d995232e.42f06","template":"{{ states('input_text.vrijdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":660,"y":280,"wires":[["1f89844d.37a90c"]]},{"id":"559e5ce.6391da4","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template zaterdag","server":"d995232e.42f06","template":"{{ states('input_text.zaterdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":670,"y":320,"wires":[["1f89844d.37a90c"]]},{"id":"b5d866a1.ed7d58","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template zondag","server":"d995232e.42f06","template":"{{ states('input_text.zondag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":670,"y":360,"wires":[["1f89844d.37a90c"]]},{"id":"ef2fa60b.dcad08","type":"switch","z":"c380e0f0.3d8dc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Maandag","vt":"str"},{"t":"eq","v":"Dinsdag","vt":"str"},{"t":"eq","v":"Woensdag","vt":"str"},{"t":"eq","v":"Donderdag","vt":"str"},{"t":"eq","v":"Vrijdag","vt":"str"},{"t":"eq","v":"Zaterdag","vt":"str"},{"t":"eq","v":"Zondag","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":430,"y":640,"wires":[["230d8acc.264cd6"],["95a5ee43.0bbad"],["c752978a.589a48"],["3995a4d7.8c52fc"],["9863b6cd.b19238"],["2ce1cb1b.0231e4"],["97f88eb8.1d904"]]},{"id":"230d8acc.264cd6","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template dinsdag","server":"d995232e.42f06","template":"{{ states('input_text.dinsdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":650,"y":580,"wires":[["4452f995.375368"]]},{"id":"97f88eb8.1d904","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template maandag","server":"d995232e.42f06","template":"{{ states('input_text.maandag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":650,"y":540,"wires":[["4452f995.375368"]]},{"id":"95a5ee43.0bbad","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template woensdag","server":"d995232e.42f06","template":"{{ states('input_text.woensdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":650,"y":620,"wires":[["4452f995.375368"]]},{"id":"c752978a.589a48","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template donderdag","server":"d995232e.42f06","template":"{{ states('input_text.donderdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":660,"y":660,"wires":[["4452f995.375368"]]},{"id":"3995a4d7.8c52fc","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template Vrijdag","server":"d995232e.42f06","template":"{{ states('input_text.vrijdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":640,"y":700,"wires":[["4452f995.375368"]]},{"id":"9863b6cd.b19238","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template zaterdag","server":"d995232e.42f06","template":"{{ states('input_text.zaterdag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":650,"y":740,"wires":[["4452f995.375368"]]},{"id":"2ce1cb1b.0231e4","type":"api-render-template","z":"c380e0f0.3d8dc","name":"template zondag","server":"d995232e.42f06","template":"{{ states('input_text.zondag') }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":650,"y":780,"wires":[["4452f995.375368"]]},{"id":"4452f995.375368","type":"api-call-service","z":"c380e0f0.3d8dc","name":"tts broadcast","server":"d995232e.42f06","version":1,"debugenabled":false,"service_domain":"notify","service":"ga_broadcast","entityId":"","data":"{\"message\":\"Morgen eten we {{payload}} \"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":910,"y":600,"wires":[[]]},{"id":"1095b012.9170c","type":"comment","z":"c380e0f0.3d8dc","name":"Wat eten we vandaag?","info":"","x":110,"y":60,"wires":[]},{"id":"4ba22ecd.488db","type":"comment","z":"c380e0f0.3d8dc","name":"Wat eten we morgen?","info":"","x":100,"y":480,"wires":[]},{"id":"d995232e.42f06","type":"server","name":"Home Assistant"}]
For the lovelace card I used a conditional card in a vertical stack.
type: vertical-stack
cards:
- type: conditional
conditions:
- entity: sensor.day
state: Vrijdag
card:
type: picture-entity
entity: input_text.vrijdag
image: /local/pictures/menu
- type: conditional
conditions:
- entity: sensor.day
state: Zaterdag
card:
type: picture-entity
entity: input_text.zaterdag
image: /local/pictures/menu
- type: conditional
conditions:
- entity: sensor.day
state: Zondag
card:
type: picture-entity
entity: input_text.zondag
image: /local/pictures/menu
- type: conditional
conditions:
- entity: sensor.day
state: Maandag
card:
type: picture-entity
entity: input_text.maandag
image: /local/pictures/menu
- type: conditional
conditions:
- entity: sensor.day
state: Dinsdag
card:
type: picture-entity
entity: input_text.dinsdag
image: /local/pictures/menu
- type: conditional
conditions:
- entity: sensor.day
state: Woensdag
card:
type: picture-entity
entity: input_text.woensdag
image: /local/pictures/menu
- type: conditional
conditions:
- entity: sensor.day
state: Donderdag
card:
type: picture-entity
entity: input_text.donderdag
image: /local/pictures/menu
Last thing to do was to create a routine in GH. ‘Hey Google, Turn on what’s for dinner’ doesn’t sound that natural. When I say what’s for dinner tonight she will turn on the input_boolean what_eat_today and with that trigger the flow for broadcasting what’s for dinner.