Homey Community Forum

Automating my cleaning lady, help needed with logic and variables

Hi,

I need help with some flows. I want to give my cleaning lady a Tile (beacon). And register when she comes in, and when she leaves. Then i want to calculate the hours she worked so i can sent her a message on the money i ow her.

Is this possible? I think i should use Logic for this and set some variables, but i really could use some help with this.

Any ideas?

why? you think she is lying about the hours she makes??

You could also install locative on her iphone or some other app when its android. I think presence detection is a way to do this.

Just to pay her, she sometimes work one hour, other times more then 3 hours.

The presence part isn’t the problem, i need help with the Logic part

Perhaps use the count up timer…

Not sure if it is still available, but I do remember an experimental app that does countdown and count up. So, when present, start countup.

https://apps.athom.com/app/nl.fellownet.chronograph

Great tip!!! Thanx.

Cheers!

Using Chronograph helps. Now i can make a few flows:

  • when beacon in range, start stopwatch YYY
  • when beacon out of range, stop stopwatch YYY
  • when stopwatch YYY is stopped, calculate an value with Logic

Then i think i have to set a Numeric Variable… and then i get lost…

I can make a variable in More > Logic > New > Type should be Number probably, but what do i fill in at Value ?

You don’t need to calculate, juist read the stopwatch value. That is what you wanted!

The stopwatch time/value is in Seconds.

And i want to sent a message with the worked time (hours) in it. (So the calculation part must be something like Stopwatch value / 3600)

How would you solve this?

in the app settings of Logic you have to define a variable (hours) before

Flow:
when: stop watch stopped
then: based on the duration, Logic calculates seconds to hours

Which one do you use?

Thanx for the help

You post the options of the when area. But you have to select the options in the then area.

You are correct. Thanx. I got it working now. Thanx all !!!

Now a bonus question :slight_smile:

Naamloos

How can I round this number to two decimal places?

{{round(dauer(s)/3600, 2)}}

I think to round a number you have to use the app „better logic“ instead of the bulidin Logic app

It works with the built in logic. No better Logic necessary.

@Osorkon you‘re right and I‘ve learned something :wink:

https://community.athom.com/t/available-math-functions/16622/3