How about starting the day with a random quote, or getting encouragement after a workout?
With the help of the automation in Home Assistant, this is possible to implement.
In this example, we have used Node-Red to create the automation itself, but it can also be done by using the automation in Home Assistant.

The quotes that we have included in the example are used after completing a training session. But there is nothing stopping you from posting any quotes and using any “trigger” to send a quote. For example. you can use the time, and send it at 7 in the morning as a good-morning message.

To send a random quote, we must first build a “database” of which quotes we can use. In Node-Red we use the code block “functions” for this purpose.

In the properties of this block, we enter all the messages that the system can choose to send.

To send the message, we use the code block “Call service”.
Here we enter which function in Home Assistant is to be run (notify) and which mobile phone is to receive the message.
Instead of writing a message, we then retrieve the content from the previous code block.

{
    "message": " {{msg.payload.data.message}}",
    "title": "Nice!"
}

Then just find some great quotes you want to send out, and get started.

The entire Node-Red code can be found here:

[{"id":"5de7a88f.3a4e38","type":"function","z":"5598a227.a2472c","name":"Random messages","func":"msg.payload = {};\nmsg.payload.data = {};\nmsg.payload.data.message ={};\n\nvar myArray = [\n  \"You may not be there yet, but you are closer than you were yesterday\",\n  \"The pain you feel today, will be the strength you feel tomorrow.\",\n  \"A little progress each day adds up to big results\",\n  \"A one hour workout is 4% of your day. Well done!\",\n  \"The best investment you make is your own health.\",\n  \"Three months from now, you will thank yourself\",\n  \"Remember, Rome wasn’t built in a day. Work hard, good results will come\",\n  \"Once you see results, it becomes an addiction\",\n  \"Strive for progress, not perfection.\",\n  \"Keep going, you are getting there\",\n  \"The only bad workout is the one that didn’t happen\",\n  \"Sweat is your fat crying\",\n  \"You don't sweat, You sparkle\",\n  \"Well done is better than well said\",\n  \"It's a slow process, but quitting won't speed it up\",\n  \"There's plenty of time to rest when you're done\"\n];\n\nvar randomItem = myArray[Math.floor(Math.random()*myArray.length)];\n\nmsg.payload.data.message = randomItem;\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":790,"y":320,"wires":[["3c05af8ae86f547a"]]},{"id":"9c29fb7e.4a8528","type":"inject","z":"5598a227.a2472c","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":580,"y":320,"wires":[["5de7a88f.3a4e38"]]},{"id":"3c05af8ae86f547a","type":"api-call-service","z":"5598a227.a2472c","name":"Notify mobile","server":"7d84d6a9.3d98f8","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_lars_sin_iphone_11","entityId":"","data":"{\"message\":\" {{msg.payload.data.message}}\",\"title\":\"Nice!\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1010,"y":320,"wires":[[]]},{"id":"7d84d6a9.3d98f8","type":"server","name":"Home Assistant"}]

Some of the links in this article are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.

By Lars

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.