I have been through the other similar topics but I have been unable to modify them to suit
I am very new to home assistant but have been able to get this working.
It monitors my energy consumption via a shelly em and if I start exporting (I have solar) it switches on my hot water immersion heater for 30mins then it loops back and checks for export again
what I would like it to do is only run 4 times each day and send a message to my phone once its run 4 times when send a message to my phone.
Thanks in advance for any help you can give
id: ‘164917665xxxx’
alias: Export test 5
description: ‘’
trigger:
I have 0 experience with home assistant but this code works, I understand its not pretty but that’s why I am here so that hopefully someone can help. I’ll try and format the code better now
To format your code all you do is add ``` to the beginning and again at the end… NO biggie, I’ve made worse mistakes posting OR if you see above when you type there is </> hit that and put your code where it says ‘type or paste code here’ or something like that
It doesn’t copy correctly at times… but go back and look at your code and fix the spacing and things that aren’t right The above example is spaced incorrectly but that’s how it copied… before I posted [if I had an actual question about it] I would fix it from looking at my code where I copied it. Like this →
I don’t have time to fully write up yaml but to solve this problem I would use an [input _number](https://www.home-assistant.io/integrations/input_number/) to keep track of how many times the automation turns on. Then in your automation you will have to add a [condition](https://www.home-assistant.io/docs/scripts/conditions/) that checks the numeric_state of your input_number is below 4 and you will also have to add an action that increases the input _number by one.
You will then need another automation that calls a notify service when the input _number reaches four.
You will then need another automation that resets the input _number to zero at midnight or whatever time you want.