Make a sentence containing trigger times

#1

I’d like to have a short summary of peoples wherabouts on my living room panel, "person X left home at " & when the ishome reactor went FALSE in readable time.

I can use the multistring app (for lack of a better alternative) to display this, if someone can guide me to the expression syntax for this?

#2

I think this will give you something to play with:

#3

Theory of operation:

At the moment, you can’t directly get the modified time of a state variable, so we can’t pluck the time when GroupStatus_grpcyhjmza changes directly. So, xxx_lasthome stores the “previous” value of xxx_ishome. Then, xxx_ishome is the group status containing the geofence condition, grabbed using the getstate() function. The xxx_changetime variable uses an if() expression to return the current time if last home state and current home state are different (i.e. state has changed); otherwise it returns its own previous value (no change).

Finally, xxx_text builds the readable text.

The Expressions page in the wiki documents the functions used (and has links to docs for other expression info related to the underlying library, LuaXP).

#4

Thanks!

I know i could probably figure it out through documentation, but with limited experience in LUA, or what reactor offers in terms of variables, it would take some effort. A map of the variable structure would mabye make it easier, but until im more familiar with it, I think its better to ask for the “correct” approach from people who know it rather than spend hours on a less efficient solution. :wink: (Call me lazy, its OK)

#5

Ha ha I’ve been looking for something like this to enhance what I can do with the geofencing since you helped me get this working a few months back! I made a sensor that reports “connor is home” and shows tripped or untripped that I use a a condition in a lot of scenes, but I kinda like the way you’re doing it better. I always get so may more ideas every time I visit this board!

#6

So, it works, but the multistring plugin won’t take it:

image

Any suggestions to how to show this in imperihome?

Edit: this happened when I used the “change device state” in activities, i just realized i can do it usin LUA code in the activity instead…

#7

Didn’t find out why reactor sent {PerHome_Text} and not the contents of it, so i left it for a few days, and now suddenly it works as intended. :slight_smile: Did you fix something @rigpapa, or did it just need a luup reload?

#8

No updates from me! I’m not even near code at the moment.