- alias: Work Log - Overtime [Begin]
trigger:
platform: time
at: '17:00:00'
condition:
condition: state
entity_id: device_tracker.bob_s8
state: 'Work'
action:
service: input_boolean.turn_on
entity_id: input_boolean.overtime
- alias: Work Log - Overtime [End]
trigger:
platform: zone
entity_id: device_tracker.bob_s8
zone: zone.work
event: leave
action:
service: input_boolean.turn_off
entity_id: input_boolean.overtime
Frontend:
The problem is that at our company overtime is only allowed after 30 minutes. Regular office hours start at 8am and end at 5pm. This means that if I leave at 5.20, no overtime must be registered but if I leave at 5.40, 40 minutes of overtime must be registered. In my current setup, overtime starts at 5pm regardless of the end time. What I’m trying to achieve is that at 5.30pm the ticker start ticking but also immediately adds 30 minutes of overtime.
Does anyone know how this can be done? As far as I know, there is no such option like set_value for a regular sensor. If this option was available, I could simply create an automation which turns the input_boolean to ‘on’ and adds 30 minutes to the sensor value.
I hope someone can help me out or point me in the right direction. I know it can be done by using a ‘dummy’ mqtt sensor but I don’t want to complicate thing unless it’s absolutely necessary. Also, the sensor value would probably reset on reboot and I must be able to calculate the time for the entire week.
So what this does is counts the number of on’s per week. And it counts the minutes from 5:30 on. For each count we have, there should be 30 minutes, meaning 30*count. So add the minutes from 5:30 on + 30 minutes * count.
@petro first of all: thanks a lot for helping me out, much appreciated!
If I understand correct, your suggestion counts the times the input_boolean went to “on” state. But how is it going to determine if I went home at 7:00PM, 8:00PM, 9:30PM etc? That obviously makes a lot of difference for the total time (every minute after 17:30 should be accounted for) . Or am I missing something?