# Automating my cleaning lady, help needed with logic and variables

**URL:** <https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759>\
**Category:** Questions & Help\
**Created:** [October 26, 2019, 10:41am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759 "2019-10-26T10:41:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 26, 2019, 10:41am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/1 "2019-10-26T10:41:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [October 26, 2019, 12:03pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/3 "2019-10-26T12:03:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 26, 2019, 12:57pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/4 "2019-10-26T12:57:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 26, 2019, 1:00pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/5 "2019-10-26T13:00:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 26, 2019, 2:54pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/6 "2019-10-26T14:54:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [October 26, 2019, 3:25pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/7 "2019-10-26T15:25:56Z")

</div>

[https://apps.athom.com/app/nl.fellownet.chronograph](https://apps.athom.com/app/nl.fellownet.chronograph)

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 26, 2019, 7:28pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/8 "2019-10-26T19:28:01Z")

</div>

Great tip!!! Thanx.

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 26, 2019, 7:29pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/9 "2019-10-26T19:29:02Z")

</div>

Cheers!

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 26, 2019, 7:58pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/10 "2019-10-26T19:58:56Z")

</div>

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 ?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/7/37d13486e873d34b567794bf3933c41378320dad.jpeg)

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [October 27, 2019, 4:30pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/11 "2019-10-27T16:30:03Z")

</div>

> [@Jaap](#):
>
> when stopwatch YYY is stopped, calculate an value with Logic

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

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 27, 2019, 6:33pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/12 "2019-10-27T18:33:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [October 27, 2019, 7:48pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/13 "2019-10-27T19:48:48Z")

</div>

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/4/240f13c472e0e142dad07d3677100761faf09308.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 27, 2019, 9:21pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/14 "2019-10-27T21:21:32Z")

</div>

Which one do you use?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/0/1088936804e22bafa04692fc1a9396ad1c73e322.png)

Thanx for the help

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [October 27, 2019, 9:38pm UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/15 "2019-10-27T21:38:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 28, 2019, 8:24am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/16 "2019-10-28T08:24:11Z")

</div>

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

Now a bonus question 🙂

![Naamloos](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/9/c9a44021120c86b6dfb1f4e58f29084e93ef8b0b.jpeg)

How can I round this number to two decimal places?

---

<div class="post-metadata">

**Author:** ![Osorkon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/osorkon/32/43026_2.png) [@Osorkon](https://community.homey.app/u/Osorkon)\
**Post date:** [October 28, 2019, 8:31am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/17 "2019-10-28T08:31:39Z")

</div>

> [@Jaap](#):
>
> How can I round this number to two decimal places?

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

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [October 28, 2019, 8:53am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/18 "2019-10-28T08:53:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Osorkon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/osorkon/32/43026_2.png) [@Osorkon](https://community.homey.app/u/Osorkon)\
**Post date:** [October 28, 2019, 9:05am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/19 "2019-10-28T09:05:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [October 28, 2019, 10:00am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/20 "2019-10-28T10:00:13Z")

</div>

@Osorkon you‘re right and I‘ve learned something 😉

[https://community.homey.app/t/available-math-functions/16622/3](https://community.homey.app/t/available-math-functions/16622/3)

---

<div class="post-metadata">

**Author:** ![Jaap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaap/32/2328_2.png) [@Jaap](https://community.homey.app/u/Jaap)\
**Post date:** [October 28, 2019, 10:37am UTC](https://community.homey.app/t/automating-my-cleaning-lady-help-needed-with-logic-and-variables/19759/21 "2019-10-28T10:37:55Z")

</div>

It all works perfect, thanx for all the help!!! learned a lot.
