Get a detailed Notification about the Energy Consumption when a household appliance is done

Okay guys,

I have an idea but I don't know exactly how to implement it.
Like to use Node Red and Home Assistant.

I want to increase the awareness of energy consumption and costs in our household.
And get an indication of how much electricity or euros a device has consumed when it is turned off.

I have Shelly S and Shelly Plug 2 connected to many appliances.
A washing machine, dryer, dishwasher, kettle, coffee maker, instant water heater for the shower (Shelly 3M)....and more will follow.

Now I am looking for a universal Node Red Flow that can do the calculation and send a message to my devices (ios or android / alexa / google home - depending on what you have).
The push notification should say Which device just finished, How long it ran, How much power it used and what it cost in total and also for better comparison per hour.

I want to divide everything modular into sections (subflows).

The first section is for the general settings like price per kWh, resolution (how often the consumption is queried or checked if a device is running or not).
All devices should also be listed here with their own settings such as a consumption threshold for standby and a time from when a device is considered switched on or off. For the notifications, you can also enter placeholders for the message like button text, icons, and sounds...

From there it flows into a calculation subflow. There it is tracked if the machine/device is running, for how long and with what energy consumption.
Here it is calculated when it was started and stopped. How much energy it has consumed and, for example, how much washing or drying has cost in energy.

From this comes the content of the notification.
Now comes a check. The notification should be sent only if the time is between 6 am and 10 pm.
The notification should be sent to all devices (iPhones, tablets, Apple Watches....), but only triggered when the person who owns the devices is at home.

From there it flows into another subflow for the notification. This can be one for Android and one for iOS or Google Home/Alexa.

The title of the notification needs to be the "friendly name" of the device.
The subtitle should be something like "ready" or "done" or "finished" according to the application
The notification shall include a random salutation to the user, the duration of the device was turned on, energy consumption calculations, effective cost and for comparison cost per h.

There shall also be actionable buttons to cancel the message and to turn off the Shelly Plug to which the machine is connected.

TITLE: Washing machine
Subtitle: is ready
Good evening USER, the washing machine is done. It ran for 183 minutes and used 1.2kWh. It cost 0,32€ (0,10 €/h).

Action Buttons:
Ignore message
Switch off machine

I found some sources that do parts of it But I failed to get it all working in one.

SOURCES: (have more but I can post only two links)

This seems fairly simple using mqtt.
Please supply a sample of -
mqtt start/turn on messages.
mqtt stop turn of messages.
(both these should include power messages also)
a couple of device topics received from different devices
Also how do you wish to send the notification?

All data/messages in text format

My first thought is to use a database, allowing you to do analysis with historical data.

When Node-red receives notification that a device was turned on, INSERT a record with device name, ontime and consumption.

When a device is turned off, UPDATE the record with offtime and consumption.
Trigger a query to calculate cost etc in the database.
Construct and send the notification in Node-red.

Does it require a db?

I would save start/on power to context under topic name, then when stop/off message is received deduct powers and send notification and delete context. Probably a 3-4 node flow.

No it doesn't require a db.

I find that specifications tend to change.
"Oh, that's nice but can you show me how much we have saved since we got the new washing machine?"
If the data is in a db, yes I can.

Also I'm not fully up to speed with persistent context and I may deploy and/or reboot many times a day.

Hey E1cid,
thanks for reading and replying. That's awesome.

I have not used MQTT yet.
So I am using the HomeAssistant Palette.

For input of the Devices, I use the "current state" Node and for Notification the "call Service" Node.
Also saw that there is a " Actionable Notifications Subflow for iOS" Subflow Node but I do not know if that makes things easier or more complicated yet.

This is my first "sketch" - not working yet.

My Biggest issue so far is how to get the values like the entity attribute friendly_name and pass them through to the notification.
For the price I got a helper Object for the price per kWh [input_number.priceperkwh]

TITLE: {{payload.entity_friendly_name}}
SUBTITLE: {{payload.appliance_status}}
MESSAGE: {{payload.greeting}} {{payload.users_name}}
the {{payload.entity_friendly_name}} has {{payload.appliance_status}}.
Total time: {{ payload.time }} minutes.
Total energy: {{ payload.energy }} kWh.
Cost: {{ payload.cost }} € ( {{ payload.cost_per_h }} €/h )

[{"id":"a42d656b725962b1","type":"tab","label":"Energy Awareness Notification","disabled":false,"info":"https://discourse.nodered.org/t/get-a-detailed-notification-about-the-energy-consumption-when-a-household-appliance-is-done/73871","env":[]},{"id":"36e4f3bafa85172f","type":"power-monitor","z":"a42d656b725962b1","name":"","startthreshold":"15","stopthreshold":"3","startafter":"1","stopafter":"1","energydecimals":"","emitidle":false,"x":680,"y":360,"wires":[["9c56ba3b73d7b600","4be1f30ff6ed6c7a"]]},{"id":"1568ee7d3de4ae8c","type":"api-current-state","z":"a42d656b725962b1","name":"","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.shelly_plug_s_laptop_power","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"name","propertyType":"msg","value":"$entity().attributes.friendly_name","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":330,"y":360,"wires":[["36e4f3bafa85172f","0d0e7218e534651b"]]},{"id":"ecba7f214aea4dff","type":"link in","z":"a42d656b725962b1","name":"link in 25","links":["f450be6d9b36de48"],"x":95,"y":360,"wires":[["1568ee7d3de4ae8c"]]},{"id":"f450be6d9b36de48","type":"link out","z":"a42d656b725962b1","name":"link out 31","mode":"link","links":["ecba7f214aea4dff"],"x":615,"y":140,"wires":[]},{"id":"e304198f8dba453a","type":"inject","z":"a42d656b725962b1","name":"Resolution (10 sec) Check Powerconsumption every Minute","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":140,"wires":[["f450be6d9b36de48"]]},{"id":"fdcc670ddcecdfd5","type":"comment","z":"a42d656b725962b1","name":"Settings","info":"//timeout - adjust as needed. This is how responsive\nthe notification will be, but if washing machine\nhas downtimes with low power consumption increase the\ntimeout value\n\n\n//standbypower - measure how much power the washing \nmachine draws when on standby. Set the value to be \nslightly above that","x":200,"y":100,"wires":[]},{"id":"508bcafa5919ec7e","type":"comment","z":"a42d656b725962b1","name":"Sources","info":"https://tinkerman.cat/post/useful-notifications-from-your-home-appliances-using-node-red/","x":200,"y":20,"wires":[]},{"id":"0e9a91bdf6a3ca77","type":"comment","z":"a42d656b725962b1","name":"Settings Power-Monitor","info":"Name: Name of the appliance. Will be attached to the output object.\nPower threshold: Value (in watts) to tell whether the appliance is running or not, an ideal value would be 0 (0W if not running).\nStart after: Number of messages with readings over the threshold to trigger a start event.\nStop after: Number of messages with readings below the threshold to trigger a stop event.","x":700,"y":320,"wires":[]},{"id":"9c56ba3b73d7b600","type":"function","z":"a42d656b725962b1","name":"pre-process","func":"msg.payload.time = Math.round(msg.payload.time / 60);\nmsg.payload.cost = Math.round(msg.payload.energy * 16.66) / 100;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":360,"wires":[["304932a4668ac7ac","2bb96a499caa1ea6"]]},{"id":"f5f20cce4610cac0","type":"comment","z":"a42d656b725962b1","name":"Calculate Consumption","info":"","x":980,"y":320,"wires":[]},{"id":"304932a4668ac7ac","type":"template","z":"a42d656b725962b1","name":"message Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.greeting}} {{payload.users_name}} \nthe {{payload.appliance_name}} has {{payload.appliance_status}}.\nTotal time: {{ payload.time }} minutes.\nTotal energy: {{ payload.energy }} kWh.\nCost: {{ payload.cost }} € Cost per/H: {{ payload.cost_per_h }} €","output":"str","x":1250,"y":360,"wires":[["e7b42eeb94057501","95a075f91b60847c"]]},{"id":"a6319db19da8f2e5","type":"comment","z":"a42d656b725962b1","name":"Generate Message","info":"","x":1250,"y":320,"wires":[]},{"id":"a6380a20e80267d4","type":"comment","z":"a42d656b725962b1","name":"Notify","info":"","x":1470,"y":320,"wires":[]},{"id":"0d0e7218e534651b","type":"debug","z":"a42d656b725962b1","name":"debug 148","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":450,"y":420,"wires":[]},{"id":"2bb96a499caa1ea6","type":"debug","z":"a42d656b725962b1","name":"debug 149","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":950,"y":420,"wires":[]},{"id":"e7b42eeb94057501","type":"debug","z":"a42d656b725962b1","name":"debug 150","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1270,"y":420,"wires":[]},{"id":"56ca610ef8e73783","type":"debug","z":"a42d656b725962b1","name":"debug 151","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1650,"y":420,"wires":[]},{"id":"4be1f30ff6ed6c7a","type":"debug","z":"a42d656b725962b1","name":"debug 152","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":690,"y":420,"wires":[]},{"id":"3613e5219c36bacf","type":"comment","z":"a42d656b725962b1","name":"Imput Devices","info":"","x":210,"y":320,"wires":[]},{"id":"95a075f91b60847c","type":"api-call-service","z":"a42d656b725962b1","name":"","server":"","version":5,"debugenabled":true,"domain":"notify","service":"mobile_app_iphone_6s_von_martin","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":1580,"y":360,"wires":[["56ca610ef8e73783"]]},{"id":"d7e1b72369dd76c4","type":"inject","z":"a42d656b725962b1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"my notification message","payloadType":"str","x":1520,"y":280,"wires":[["95a075f91b60847c"]]},{"id":"4ddf4182dc65019c","type":"inject","z":"a42d656b725962b1","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"my notification message","payloadType":"str","x":1240,"y":280,"wires":[["304932a4668ac7ac"]]}]

@ [jbudd]
I also do not think that it needs a db - as I do not want to store the data longterm.

I can not help with HA as i do not use it.

I suggest you turn on MQTT on the devices and set up a MQTT broker Once you have that and see the device messages it would be fairly dtraight forward to impliment.

Or

Someone may be able to help using HA or as on HA forum.

Thanks for your Reply.
I have to look into MQTT and get to know that too.

But for now, I am already quite far.
I managed to get almost all the Parts of the Message (title, Subtitle, Greeting Message..)
Do not know how to get the "name" of the notified Phone - but I can do that manually as these are just three people and three devices.

What I did not manage to do yet is to combine all the info into one message and push it to the phones.

Guess the Way I build the Flow is quite horrible. As I have no clue of the Tools yet.
I remember seeing one guy painting the background in Paint white with a brush cause he did not know of the fill tool. - Thats how I feel right now.

here is my flow so far.

[{"id":"a42d656b725962b1","type":"tab","label":"Energy Awareness Notification","disabled":false,"info":"https://discourse.nodered.org/t/get-a-detailed-notification-about-the-energy-consumption-when-a-household-appliance-is-done/73871","env":[]},{"id":"e1b31b7f80364432","type":"group","z":"a42d656b725962b1","name":"Home or out","style":{"label":true},"nodes":["ebd57dbe40392241","3b72107907a19928","b3b4162fd6e741aa"],"x":94,"y":1019,"w":710,"h":122},{"id":"c44c467eed32acd4","type":"group","z":"a42d656b725962b1","name":"debugging","style":{"label":true},"nodes":["18c0b3ad57abe572","5d1c80f791b66503","cbfb9c02d0e25bae"],"x":94,"y":859,"w":472,"h":122},{"id":"36e4f3bafa85172f","type":"power-monitor","z":"a42d656b725962b1","name":"","startthreshold":"15","stopthreshold":"3","startafter":"1","stopafter":"1","energydecimals":"","emitidle":false,"x":680,"y":360,"wires":[["661fb0569fd407ea","f9e172b4ee4aea66","88b47bb1629b8bb7","a30ea99f3df2b377"]]},{"id":"1568ee7d3de4ae8c","type":"api-current-state","z":"a42d656b725962b1","name":"","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.shelly_plug_s_laptop_power","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"name","propertyType":"msg","value":"$entity().attributes.friendly_name","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":330,"y":360,"wires":[["36e4f3bafa85172f","d87468520ce9af69"]]},{"id":"ecba7f214aea4dff","type":"link in","z":"a42d656b725962b1","name":"link in 25","links":["f450be6d9b36de48"],"x":95,"y":360,"wires":[["1568ee7d3de4ae8c"]]},{"id":"f450be6d9b36de48","type":"link out","z":"a42d656b725962b1","name":"link out 31","mode":"link","links":["ecba7f214aea4dff"],"x":615,"y":140,"wires":[]},{"id":"e304198f8dba453a","type":"inject","z":"a42d656b725962b1","name":"Resolution (10 sec) Check Powerconsumption every Minute","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":140,"wires":[["f450be6d9b36de48"]]},{"id":"fdcc670ddcecdfd5","type":"comment","z":"a42d656b725962b1","name":"Settings","info":"//timeout - adjust as needed. This is how responsive\nthe notification will be, but if washing machine\nhas downtimes with low power consumption increase the\ntimeout value\n\n\n//standbypower - measure how much power the washing \nmachine draws when on standby. Set the value to be \nslightly above that","x":200,"y":100,"wires":[]},{"id":"508bcafa5919ec7e","type":"comment","z":"a42d656b725962b1","name":"Sources","info":"https://tinkerman.cat/post/useful-notifications-from-your-home-appliances-using-node-red/","x":200,"y":20,"wires":[]},{"id":"0e9a91bdf6a3ca77","type":"comment","z":"a42d656b725962b1","name":"Settings Power-Monitor","info":"Name: Name of the appliance. Will be attached to the output object.\nPower threshold: Value (in watts) to tell whether the appliance is running or not, an ideal value would be 0 (0W if not running).\nStart after: Number of messages with readings over the threshold to trigger a start event.\nStop after: Number of messages with readings below the threshold to trigger a stop event.","x":700,"y":260,"wires":[]},{"id":"9c56ba3b73d7b600","type":"function","z":"a42d656b725962b1","name":"pre-process","func":"msg.payload.time = Math.round(msg.payload.time / 60);\nmsg.payload.cost = Math.round(msg.payload.energy * msg.strompreis) / 100;\nmsg.payload.cost_per_h = Math.round(msg.payload.energy / (msg.payload.time / 60) * msg.strompreis) / 100;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1130,"y":720,"wires":[["ca29003ee5fe494c","3be0253a330d8ff5"]]},{"id":"f5f20cce4610cac0","type":"comment","z":"a42d656b725962b1","name":"Calculate Consumption","info":"","x":980,"y":260,"wires":[]},{"id":"a6319db19da8f2e5","type":"comment","z":"a42d656b725962b1","name":"Generate Message","info":"","x":1750,"y":260,"wires":[]},{"id":"a6380a20e80267d4","type":"comment","z":"a42d656b725962b1","name":"Notifications","info":"","x":1990,"y":260,"wires":[]},{"id":"3613e5219c36bacf","type":"comment","z":"a42d656b725962b1","name":"Imput Devices","info":"","x":210,"y":260,"wires":[]},{"id":"18c0b3ad57abe572","type":"debug","z":"a42d656b725962b1","g":"c44c467eed32acd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":940,"wires":[]},{"id":"5d1c80f791b66503","type":"catch","z":"a42d656b725962b1","g":"c44c467eed32acd4","name":"Catch ALL errors for this flow","scope":null,"uncaught":false,"x":240,"y":940,"wires":[["18c0b3ad57abe572"]]},{"id":"cbfb9c02d0e25bae","type":"comment","z":"a42d656b725962b1","g":"c44c467eed32acd4","name":"debugging","info":"","x":180,"y":900,"wires":[]},{"id":"004ae804820a83cc","type":"change","z":"a42d656b725962b1","name":"Set notification attributes","rules":[{"t":"set","p":"title","pt":"msg","to":"string, payload or whatever input","tot":"str"},{"t":"set","p":"message1","pt":"msg","to":"string, payload or whatever input","tot":"str"},{"t":"set","p":"message2","pt":"msg","to":"string, payload or whatever input","tot":"msg"},{"t":"set","p":"message3","pt":"msg","to":"string, payload or whatever input","tot":"str"},{"t":"set","p":"critical","pt":"msg","to":"0 or 1","tot":"str"},{"t":"set","p":"sound","pt":"msg","to":"default (critical notifications has different default sound than non critical) or wav: https://companion.home-assistant.io/docs/notifications/notification-sounds/#pre-installed-notification-sounds","tot":"str"},{"t":"set","p":"volume","pt":"msg","to":"1.0 (100%) or 0.n (n %)","tot":"str"},{"t":"set","p":"target","pt":"msg","to":"mobile_app_<your_device_id_here>","tot":"str"},{"t":"set","p":"category","pt":"msg","to":"set_iOS_action_category_from_yaml","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":220,"wires":[[]]},{"id":"ebd57dbe40392241","type":"trigger-state","z":"a42d656b725962b1","g":"e1b31b7f80364432","name":"","server":"","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":["person.ina","person.martin"],"entityidfiltertype":"list","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is_not","comparatorValueDatatype":"prevEntity","comparatorValue":"state"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":270,"y":1100,"wires":[["3b72107907a19928"],[]]},{"id":"3b72107907a19928","type":"api-call-service","z":"a42d656b725962b1","g":"e1b31b7f80364432","name":"","server":"","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_iphone_6s_von_martin","areaId":[],"deviceId":[],"entityId":[],"data":"{ \t    \"title\": \"Location update \" & $entities(\"sensor.time\").state,\t    \"message\": data.event.new_state.attributes.friendly_name & (payload = \"not_home\" ? \" has left \" & data.event.old_state.state) & (data.event.old_state.state = \"not_home\" ? \" arrivied at \" & payload)\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":618,"y":1100,"wires":[[]]},{"id":"b3b4162fd6e741aa","type":"comment","z":"a42d656b725962b1","g":"e1b31b7f80364432","name":"Source","info":"https://community.home-assistant.io/t/sharing-ios-notification-template-with-example-improved/176838/40","x":170,"y":1060,"wires":[]},{"id":"3c488f7e7f2cdb3d","type":"comment","z":"a42d656b725962b1","name":"Use before export","info":"https://zachowj.github.io/node-red-contrib-home-assistant-websocket/scrubber/","x":370,"y":20,"wires":[]},{"id":"d87468520ce9af69","type":"template","z":"a42d656b725962b1","name":"message Title Template","field":"title","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"the {{data.attributes.friendly_name}}","output":"str","x":1410,"y":360,"wires":[["25591f0461990902","479fdca0.35c75c"]]},{"id":"6721a9b5fb5a1309","type":"template","z":"a42d656b725962b1","name":"message Subtitle Template","field":"subtitle","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"has {{payload.event}}","output":"str","x":1420,"y":460,"wires":[["0fe2cd3ce1d9743a","479fdca0.35c75c"]]},{"id":"59fe29f38c0740ca","type":"change","z":"a42d656b725962b1","name":"Set Text","rules":[{"t":"set","p":"titles","pt":"msg","to":"attributes.friendly_name","tot":"env"},{"t":"set","p":"title","pt":"msg","to":"Lavalampe","tot":"str"},{"t":"set","p":"room","pt":"msg","to":"Arbeitszimmer","tot":"str"},{"t":"set","p":"subtitle","pt":"msg","to":"payload.event","tot":"msg"},{"t":"set","p":"time","pt":"msg","to":"payload.time","tot":"msg"},{"t":"set","p":"energy","pt":"msg","to":"payload.energy","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":220,"wires":[[]]},{"id":"661fb0569fd407ea","type":"switch","z":"a42d656b725962b1","name":"Verbraucher An oder Aus","property":"payload.event","propertyType":"msg","rules":[{"t":"eq","v":"start","vt":"str"},{"t":"eq","v":"stop","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":990,"y":460,"wires":[["6721a9b5fb5a1309"],["6721a9b5fb5a1309"]]},{"id":"027bbfbfd6aba151","type":"comment","z":"a42d656b725962b1","name":"Settings Message Text","info":"","x":1400,"y":260,"wires":[]},{"id":"3be0253a330d8ff5","type":"debug","z":"a42d656b725962b1","name":"debug 158","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1130,"y":780,"wires":[]},{"id":"25591f0461990902","type":"debug","z":"a42d656b725962b1","name":"Title","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"title","targetType":"msg","statusVal":"title","statusType":"msg","x":1350,"y":400,"wires":[]},{"id":"0fe2cd3ce1d9743a","type":"debug","z":"a42d656b725962b1","name":"subtitle","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"subtitle","targetType":"msg","statusVal":"subtitle","statusType":"msg","x":1360,"y":500,"wires":[]},{"id":"f9e172b4ee4aea66","type":"debug","z":"a42d656b725962b1","name":"payload","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"msg","x":660,"y":420,"wires":[]},{"id":"ca29003ee5fe494c","type":"template","z":"a42d656b725962b1","name":"message Template","field":"message","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Total time: {{ payload.time }} minutes.\nTotal energy: {{ payload.energy }} kWh.\nCost: {{ payload.cost }}€  ({{ payload.cost_per_h }}€/h)","output":"str","x":1390,"y":720,"wires":[["914d66f3d8bc9549","479fdca0.35c75c"]]},{"id":"88b47bb1629b8bb7","type":"function","z":"a42d656b725962b1","name":"message create Random Greeting","func":"{\n    var greeting = \"hi\";\n\n    var arr = [\n        'Hey there',\n        'Hi',\n        'Yo',\n        'Greetings',\n        'Sorry to disturb you',\n    ];\n\n    greeting = arr[Math.floor(Math.random() * arr.length)];\n\n    var payload = {\n        payload: greeting,\n    }\n\n    node.warn(payload);\n\n    return payload;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1440,"y":560,"wires":[["f47907652b04e3b3","479fdca0.35c75c"]]},{"id":"f47907652b04e3b3","type":"debug","z":"a42d656b725962b1","name":"greeting","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"msg","x":1360,"y":600,"wires":[]},{"id":"54b2903858fc3d7d","type":"comment","z":"a42d656b725962b1","name":"Get person (name) from device","info":"","x":1430,"y":660,"wires":[]},{"id":"914d66f3d8bc9549","type":"debug","z":"a42d656b725962b1","name":"message","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"message","targetType":"msg","statusVal":"message","statusType":"msg","x":1360,"y":780,"wires":[]},{"id":"27d45e90bf7901c6","type":"server-state-changed","z":"a42d656b725962b1","name":"Strompreis","server":"","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.strompreis","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":300,"wires":[[]]},{"id":"3b1adf849136934a","type":"debug","z":"a42d656b725962b1","name":"Strompreis","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"strompreis","targetType":"msg","statusVal":"strompreis","statusType":"msg","x":950,"y":780,"wires":[]},{"id":"a30ea99f3df2b377","type":"api-current-state","z":"a42d656b725962b1","name":"Strompreis","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.strompreis","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"strompreis","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":950,"y":720,"wires":[["9c56ba3b73d7b600","3b1adf849136934a"]]},{"id":"d041c773b5587363","type":"debug","z":"a42d656b725962b1","name":"msg alert","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1720,"y":680,"wires":[]},{"id":"4f8096311723282f","type":"api-call-service","z":"a42d656b725962b1","name":"Notify IOS with Message","server":"","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_iphone_6s_von_martin","areaId":[],"deviceId":[],"entityId":[],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":2030,"y":640,"wires":[["9ba180b37bef5663"]]},{"id":"9ba180b37bef5663","type":"debug","z":"a42d656b725962b1","name":"out1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":2330,"y":640,"wires":[]},{"id":"ed8c1e32.c79e28","type":"debug","z":"a42d656b725962b1","name":"msg join","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1980,"y":580,"wires":[]},{"id":"b67fdfde.581e3","type":"join","z":"a42d656b725962b1","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1710,"y":600,"wires":[["ed8c1e32.c79e28","1e2bd8170886339a"]]},{"id":"479fdca0.35c75c","type":"batch","z":"a42d656b725962b1","name":"","mode":"count","count":"4","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":1710,"y":560,"wires":[["b67fdfde.581e3"]]},{"id":"1e2bd8170886339a","type":"function","z":"a42d656b725962b1","name":"Create IOS Alert","func":"var title = msg.title\nvar subtitle = msg.subtitle\nvar greeting = msg.greeting\nvar name = msg.name\nvar message = msg.message\nvar sound = msg.sound\nvar critical = msg.critical\nvar volume = msg.volume\nvar target = msg.target\nvar final_msg = `${greeting}` + `${name}` + `${message}`\nvar category = msg.category\nvar payload = {\"data\":\n{\n    \"message\": `${final_msg}`,\n    \"title\": `${title}`,\n    \"data\": {\n        \"subtitle\": \"{{subtitle}}\",\n        \"channel\": \"Alarm\",\n        \"priority\": \"high\",\n        \"ttl\": 0,       \n        \"push\": {\n            \"category\": `${category}`,\n          \"sound\": {\n            \"name\": `${sound}`,\n            \"critical\": `${critical}`,\n            \"volume\": `${volume}`,\n          }\n        }\n    }\n}\n}\nmsg.payload = payload\nmsg.topic = target\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1740,"y":640,"wires":[["4f8096311723282f"]]}]

Thats my working solution so far.

IMG_6344.PNG

[{"id":"032beb2e24d6ca53","type":"tab","label":"Appliance Notification","disabled":false,"info":"","env":[]},{"id":"8589b4da4b7def32","type":"server-state-changed","z":"032beb2e24d6ca53","name":"","server":"HomeA","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.shelly_plug_s_laptop_power","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"title","propertyType":"msg","value":"$entity().attributes.friendly_name","valueType":"jsonata"},{"property":"title","propertyType":"flow","value":"$entity().attributes.friendly_name","valueType":"jsonata"}],"x":210,"y":380,"wires":[["fc0d621c1c95ee1f"]]},{"id":"fc0d621c1c95ee1f","type":"change","z":"032beb2e24d6ca53","name":"set payload from string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":440,"wires":[["08b71ca53dabacc3"]]},{"id":"294ccc934eab690e","type":"mqtt in","z":"032beb2e24d6ca53","name":"Appliance Data","topic":"shellies/shellyplug-s-laptop/relay/0/power","qos":"1","datatype":"json","broker":"61fdd927c8ff57f4","nl":false,"rap":false,"inputs":0,"x":100,"y":320,"wires":[[]]},{"id":"08b71ca53dabacc3","type":"change","z":"032beb2e24d6ca53","name":"Application specific Text and Settings","rules":[{"t":"set","p":"applianceName","pt":"flow","to":"Lavalampe","tot":"str"},{"t":"set","p":"applianceAction","pt":"flow","to":"leuchtete","tot":"str"},{"t":"set","p":"applianceFinished","pt":"flow","to":"ist aus.","tot":"str"},{"t":"set","p":"standbyPower","pt":"flow","to":"5","tot":"num"},{"t":"set","p":"operatingPowerMinium","pt":"flow","to":"10","tot":"num"},{"t":"set","p":"resolution","pt":"flow","to":"7","tot":"num"},{"t":"set","p":"metricFrequency","pt":"flow","to":"60","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":500,"wires":[["c560de73dcf64e31"]]},{"id":"c560de73dcf64e31","type":"power-monitor","z":"032beb2e24d6ca53","name":"","startthreshold":"15","stopthreshold":"5","startafter":"1","stopafter":"1","energydecimals":"","emitidle":false,"x":580,"y":320,"wires":[["35573768c61c2a54"]]},{"id":"35573768c61c2a54","type":"function","z":"032beb2e24d6ca53","name":"pre-process","func":"var powermonitor = \"pre_stop\";\nvar price_per_kwh = parseFloat(global.get(\"tariff\")); // get the price per kilowatt hour from the \"tariff\" property in the global object\nvar energy = parseFloat(msg.payload.energy); // get the energy usage from the \"energy\" property in the msg.payload object\nvar cost, cost_per_h;\nvar time = msg.payload.time;\nvar time_name = \"Minute\"\nvar energy_consumption = energy;\nvar energy_consumption_per_h = ((energy / time) * 60);\n\nif (msg.payload.event === \"stop\" && powermonitor === \"pre_stop\") {\n    msg.payload.time = Math.round(time / 60); // convert time to minutes\n\n    msg.payload.energy_consumption = (energy * 1000).toFixed(2); // calculate energy consumption in watt hours\n    msg.payload.energy_consumption_per_h = ((energy / time) * 60).toFixed(2); // calculate energy usage per hour\n\n    msg.payload.cost = (energy * price_per_kwh).toFixed(2); // calculate cost in currency\n    msg.payload.cost_per_h = ((msg.payload.cost / time) * 60).toFixed(2); // calculate cost per hour\n\n\n    powermonitor = msg.payload.event; // update powermonitor to the value of msg.payload.event\n\n\n    msg.payload.time_name = time <= 1 ? (time_name = \"Minuten\") : (time_name = \"Minute\");\n\n    msg.payload.energy_consumption = energy_consumption <= 1000 ? ((energy * 1000).toFixed(0)) : (energy.toFixed(2));\n    msg.payload.energy_consumption_unit = energy <= 1000 ? \"W\" : \"kW\"; // set energy consumption unit based on the energy value\n\n    msg.payload.cost = msg.payload.cost <= 100 ? (energy * price_per_kwh * 100).toFixed(0) : (energy * price_per_kwh).toFixed(2);\n    msg.payload.cost_unit = msg.payload.cost <= 100 ? \"ct\" : \"€\"; // set cost unit based on the cost value\n\n\n\n    msg.payload.energy_consumption_per_h = (energy_consumption_per_h * 60) <= 1000 ? ((energy_consumption_per_h * 60).toFixed(0)) : ((energy_consumption_per_h * 1000 * 60).toFixed(2));\n    msg.payload.energy_consumption_per_h_unit = energy_consumption_per_h <= 1000 ? \"kWh\" : \"Wh\"; // set energy consumption unit based on the energy value\n\n    msg.payload.cost_per_h = msg.payload.cost_per_h <= 100 ? (energy_consumption_per_h * price_per_kwh * 100 * 60).toFixed(0) : (energy_consumption_per_h * price_per_kwh * 60).toFixed(2);\n    msg.payload.cost_per_h_unit = msg.payload.cost_per_h <= 100 ? \"cent pro h\" : \"€/h\"; // set cost unit based on the cost value\n\n    return msg;\n}\n\npowermonitor = msg.payload.event; // update powermonitor to the value of msg.payload.event\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":380,"wires":[["f079658a1fa925ad"]]},{"id":"f079658a1fa925ad","type":"template","z":"032beb2e24d6ca53","name":"Title","field":"title","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{flow.applianceName}}","output":"str","x":810,"y":320,"wires":[["c5f4e01415aeeea1"]]},{"id":"c5f4e01415aeeea1","type":"template","z":"032beb2e24d6ca53","name":"message","field":"message","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"lief für {{ payload.time }} {{ payload.time_name }} und\nverbrauchte: {{ payload.energy_consumption }}{{ payload.energy_consumption_unit }} / {{ payload.cost }}{{ payload.cost_unit }}.\nentspricht ca. {{ payload.energy_consumption_per_h }}{{ payload.energy_consumption_per_h_unit }} / {{ payload.cost_per_h }} {{ payload.cost_per_h_unit }} .","output":"str","x":820,"y":380,"wires":[["de39815baa5397bf"]]},{"id":"6a315e496aa42288","type":"change","z":"032beb2e24d6ca53","name":"set payload from string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":120,"wires":[["e4f2eb8d4de8c101"]]},{"id":"e36675e5d18d4112","type":"comment","z":"032beb2e24d6ca53","name":"Settings","info":"","x":80,"y":80,"wires":[]},{"id":"c6b27380708a8259","type":"comment","z":"032beb2e24d6ca53","name":"Power Input","info":"","x":90,"y":280,"wires":[]},{"id":"529b536e5c04811c","type":"server-state-changed","z":"032beb2e24d6ca53","name":"Strompreis","server":"HomeA","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.strompreis","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"price_per_kwh","propertyType":"global","value":"","valueType":"entityState"},{"property":"costDay","propertyType":"flow","value":"","valueType":"entityState"},{"property":"costNight","propertyType":"flow","value":"","valueType":"entityState"},{"property":"start","propertyType":"flow","value":"0","valueType":"num"},{"property":"end","propertyType":"flow","value":"21","valueType":"num"}],"x":80,"y":120,"wires":[["6a315e496aa42288"]]},{"id":"e4f2eb8d4de8c101","type":"change","z":"032beb2e24d6ca53","name":"set msg to flow.tariff","rules":[{"t":"set","p":"tariff","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":120,"wires":[[]]},{"id":"bea5e4cebb524139","type":"comment","z":"032beb2e24d6ca53","name":"Sources","info":"Okay guys,\n\nI have an idea but I don't know exactly how to implement it.\nHave Node Red and Home Assistant.\n\nI want to increase the awareness of energy consumption and costs in our household.\nAnd get an indication of how much electricity or euros a device has consumed when it is turned off.\n\nI have Shelly S and Shelly Plug 2 connected to many appliances.\nWashing machine, dryer, dishwasher, kettle, coffee maker, instant water heater for the shower (Shelly 3M)....and more will follow.\n\nNow I am looking for a universal Node Red Flow that can do the calculation and send a message to my devices (ios or android / alexa / google home - depending on what you have).\nThe push notification should say Which device just finished, How long it ran, How much power it used and what it cost.\n\nI want to divide everything modulat into sections (subflows).\n\nThe first section is for the general settings like price per kWh, resolution (how often the consumption is queried or checked if a device is running or not). \nAll devices should also be listed here with their own settings such as a consumption threshold for standby and a time from when a device is considered switched on or off. For the notifications you can also enter placeholders for the message like button text, icons, sounds...\n\nFrom there it flows into a calculation subflow. There it is tracked if the machine/device is running, for how long and with what energy consumption.\nHere it is calculated when it was started and stopped. How much energy it has consumed and, for example, how much washing or drying has cost in energy.\n\nFrom this comes the content of the notification.\nNow comes a check. The notification should be sent only if the time is between 6 am and 10 pm.\nThe notification should be sent to all devices (iPhones, tablets, Apple Watches....), but only triggered when the person who owns the devices is at home.\n\nFrom there it flows into another subflow for the notification. This can be one for Android and one for iOS or Google Home/Alexa.\n  \nThe title of the notification needs to be the device friendly name.\nThe subtitle should be something like \"ready\" or \"done\" or \"finished\"\nThe notification shall include a salutation to the user, the duration of the device being turned on, energy consumption calculations, effective cost and cost per h.\n\nThere shall also be actionable buttons to cancel the message and to turn off the Shelly Plug to which the machine is connected.\n\nTITLE: Washing machine\nSubtitle: is ready\nHey USER, the washing machine is done. It ran for 183 minutes and used 1.2kWh. It cost 0,32€ (0,10 €/h).\n\nAction Buttons\nIgnore message\nSwitch off machine\n\nSOURCES:\nhttps://flows.nodered.org/flow/98a8426ee02261cac8f95db1d77ec464\nhttps://www.instructables.com/Washing-Machine-Notifications/\nhttps://notenoughtech.com/featured/washing-machine-notifications/\nhttps://github.com/notenoughtech/NodeRED-Projects/tree/master/DIY%20Smart%20Washing%20Machine%20%26%20Dishwasher\n\nhttps://zorruno.com/2021/nodered-appliance-completion-notification/\n\nhttps://www.fskelly.com/post/home-automation/2022/zwaveplugwashingmachinenotifications/\n\nhttps://peyanski.com/shelly-1pm-home-assistant-and-node-red-not-another-sonoff-vs-shelly-article/\nhttps://blog.squix.org/2019/09/laundry-machine-notification-with-sonoff-pow.html\nhttps://community.home-assistant.io/t/plug-w-energy-monitor-based-notify-on-finish-system/52415\nhttps://community.home-assistant.io/t/best-approach-for-creating-washing-machine-flow/360928\nhttps://tinkerman.cat/post/useful-notifications-from-your-home-appliances-using-node-red/\nhttps://www.malachisoord.com/2020/04/08/washing-machine-cycle-notifications/\n\nNodes - Power Monitor\nhttps://flows.nodered.org/node/node-red-contrib-power-monitor\nhttps://flows.nodered.org/flow/5fa4530ff24697952124a89ce4821d36\n\nNotifiations\nhttps://www.smarthomelab.ca/ios-actionable-notifications-with-home-companion/\nhttps://github.com/sstratoti/actionable-notifications-subflow-for-ios\nhttps://github.com/zachowj/node-red-contrib-home-assistant-websocket/discussions/311\nhttps://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/actionable-notifications-subflow-for-android.html\nhttps://notenoughtech.com/home-automation/tasker-nodered-notification-system/\nhttps://discourse.nodered.org/t/api-error-when-sending-notifcation-to-phone-call-service/59028/7","x":220,"y":80,"wires":[]},{"id":"83e096a60eb865bd","type":"comment","z":"032beb2e24d6ca53","name":"Use before export","info":"https://zachowj.github.io/node-red-contrib-home-assistant-websocket/scrubber/","x":410,"y":80,"wires":[]},{"id":"b4d174adeb468fb1","type":"comment","z":"032beb2e24d6ca53","name":"Operation","info":"","x":560,"y":280,"wires":[]},{"id":"17f542870d921b4e","type":"comment","z":"032beb2e24d6ca53","name":"Generate Message","info":"","x":850,"y":280,"wires":[]},{"id":"773c3e1c8264cdcd","type":"comment","z":"032beb2e24d6ca53","name":"Output to Notification Messages","info":"","x":1090,"y":280,"wires":[]},{"id":"de39815baa5397bf","type":"time-range-switch","z":"032beb2e24d6ca53","name":"","lat":"","lon":"","startTime":"6:00","endTime":"22:30","startOffset":0,"endOffset":0,"x":1030,"y":360,"wires":[["b1e2ab44ebf397ae"],[]]},{"id":"81519151d76c6bf1","type":"comment","z":"032beb2e24d6ca53","name":"Timerange ","info":"","x":1020,"y":320,"wires":[]},{"id":"3beb6ce64f57f11f","type":"comment","z":"032beb2e24d6ca53","name":"Who is home?","info":"","x":1030,"y":440,"wires":[]},{"id":"b1e2ab44ebf397ae","type":"api-current-state","z":"032beb2e24d6ca53","name":"mARTin ist zuhause?","server":"HomeA","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.martin","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"ist zuhause. ","valueType":"str"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"person","propertyType":"flow","value":"$entity().attributes.friendly_name","valueType":"jsonata"}],"for":"1","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1060,"y":480,"wires":[["79b19aebbaf1b227"],["9cfa56f49861f564"]]},{"id":"9cfa56f49861f564","type":"ha-wait-until","z":"032beb2e24d6ca53","name":"Wait until person.martin= home","server":"HomeA","version":2,"outputs":2,"entityId":"person.martin","entityIdFilterType":"exact","property":"attributes.state","comparator":"is","value":"home","valueType":"str","timeout":"10","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[{"property":"person","propertyType":"flow","value":"","valueType":"entity"}],"x":1090,"y":540,"wires":[["79b19aebbaf1b227"],[]]},{"id":"fc6ebb6555b36677","type":"comment","z":"032beb2e24d6ca53","name":"Users","info":"","x":1310,"y":460,"wires":[]},{"id":"79b19aebbaf1b227","type":"api-call-service","z":"032beb2e24d6ca53","name":"","server":"HomeA","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_iphone_6s_von_martin","areaId":[],"deviceId":[],"entityId":[],"data":"{\t    \"message\": $$.message,\t    \"title\": $$.title,\t    \"data\": {\t        \"subtitle\": $$.applianceName,\t        \"channel\": \"Alarm\",\t        \"priority\": \"high\",\t        \"ttl\": 0,\t        \"actions\": [\t            {\t                \"action\": \"{{action1}}\",\t                \"title\": \"{{action1title}}\",\t                \"icon\": \"{{action1icon}}\"\t            },\t            {\t                \"action\": \"{{action2}}\",\t                \"title\": \"{{action2title}}\",\t                \"icon\": \"{{action2icon}}\"\t            }\t        ],\t        \"persistent\": true,\t        \"tag\": \"persistent\"\t    }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1420,"y":500,"wires":[[]]},{"id":"6d1dd46215100d73","type":"function","z":"032beb2e24d6ca53","name":"Settings","func":"//see Setup tab\n","outputs":1,"noerr":0,"initialize":"//Electrical tariff info   \n\nvar tariff = {\"CostDay\": 0.291, \n              \"CostNight\": 0.291,\n              \"Start\": 7,\n              \"End\": 19};\nglobal.set(\"Tariff\", tariff);","finalize":"","libs":[],"x":80,"y":180,"wires":[[]]},{"id":"61fdd927c8ff57f4","type":"mqtt-broker","name":"","broker":"192.168.178.6","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

If you intend to stay with the HA Webhook nodes - then you would be better off working with the NR Subforum on the HA forums.

Those guys live and breathe the webhook integrations and have all the nodes available - most people on here can not load your flows as they do not have the HA extensions installed into NR.

I have done somethign very similar to what you want but all of mine is done using Tasmota flashed energy devices and MQTT

Craig

Hello Craig,

yeah, you are right. Thanks for the hint. Will post things like this in the HA Subforum next time.

I also added a "MQTT in" for the Application that can be used.
Just the constant value for the Price per kWh has to be added in whatever way is good for you guys.
And the output you like the Message to be pushed to.

Cheers

Sounds good - would like to look at what you have done - see if i can find some more inspiration - any chance of posting your flow up here ?

Also you may be interested in another HA project

Craig

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.