External Time Source / Schedule Driver for SmartThings

There is a mechanism by which you can solidify some of the scheduling issues in SmartThings, the ones involving repeating schedules, such as polling. The mechanism is to give your system an external time source.

My setup happens to have an Arduino / ThingShield, for my Lutron integration. It was trivial in the Arduino sketch, and the ThingShield device handler, to put in a once a minute message from the Arduino. This is not clock resolution timing, for sure; but it is heartbeat timing that is rock solid. I would not recommend running something like this faster that once a minute.

I have mine set to toggle a virtual switch. I can use that for other purposes, in Rules.

You could build this out of any Arduino / ThingShield pair, including Uno, Mega, etc. It costs $80 +/-.

7 Likes

Oh, I see, this is how SmartThings is going to make money. The $99 hub cannot keep time, so you have to buy a $35 ThingShield and an Arduino to complement it. :wink:

3 Likes

Indeedā€¦ probably much less; $35 for the shield, $10 for a clone Unoā€¦ :smile:

For a little more, you can add an ā€œvery accurateā€ RTC (Real Time Clock chip) with a battery (there are semi-accurate ones, and very accurate ones). And, Iā€™m typing this quick so too lazy to look, but Iā€™d bet a ā€œcronā€ library is available.

So hereā€™s a very feasible project:

  • A ā€œCRON Device Typeā€ (based on Arduino with RTC , a cron or similar scheduling library, and a ThingShield to receive schedules and send schedule triggered event calls.)

  • Alternatively build using a small Linux instance on rPi or PC type and use REST-API and Service Manager SmartApp to receive the calls. Then you could run real Linux CRON.

  • And 3rd alternative is to use a cheap hosting service (< $1.00 month) to do the second option.

SmartThings wonā€™t be too happy if we ā€œpound itā€ with incoming Events ā€¦ but, heck, the Power Usage Events from the ZigBee Centralite / SmartThings Power Outlet are super frequent anyway.

Hmmmmā€¦

Iā€™d better a dozen readers of this could whip this up in a couple days, with a couple weeks of tuning and features to make an MVP.

2 Likes

LOL. Yes indeed. I have become a co-conspirator in their secret plan. HeHeHe

You should ask for commissions. :wink:

2 Likes

Yep. This isnā€™t very hard to do, and as you say, if you want a real clock, thatā€™s not hard either. Then, someone could write a simple scheduler app on the Arduino, as you suggest, and just move this challenging-to-ST task from the cloud to a $25 computer.

Voila! Hardened schedules.

1 Like

How about Iā€™ll make it for less than $2 using ESP8266? :slightly_smiling:

2 Likes

Oh boy, sounds good. Are you sure you canā€™t get the price down some?

A zigbee clock, HA capable, so it can join ST.

And, itā€™s a zigbee repeater, just a little thing you plug in somewhere, with a battery backup. Reports AC power out / on.

3 Likes

Go for it.

Though since folks only need 1 per household, super-minimizing the cost may not be necessary.

Sure ā€¦ perhaps someone could markup a few bucks, but doubt more than a couple thousand would be boughtā€¦

Soā€¦ Is there a reliable ā€œcronā€ library for Arduio / ESP8266 / ? ā€¦

Donā€™t get @tgauchat started on capability calendar. ā€¦

1 Like

Calendar can be a unique-to-the-zigbee-clock capability.

1 Like

This is all funny, of course, but in all honesty, I feel sorry for SmartThings engineers who seem to have no pride in what they do for a living. How difficult is it to write a virtual RTC device that runs locally on the hub? I bet it would take me less than two days. :slightly_smiling:

Iā€™m sure the hub already knows what the correct time is, Iā€™m guessing this is more of an architectural backed into a corner issueā€¦

2 Likes

Ya, because they decided to put scheduling of local events into the cloud. Smart. It works so well, they should really be proud.

3 Likes

Of course it knows the time. Itā€™s running Linux kernel after all. Thatā€™s why it would be extremely easy to do.

2 Likes

Itā€™s my contention that at least most of the ā€œengineersā€ are competent and proud of what they have accomplished as a wholeā€¦ But they are constrained by management and/or legacy architecture defenders. Itā€™s a dysfunctional organization.

1 Like

Sure, but donā€™t you think those who willingly work for a ā€˜difunctional organizationā€™ are prostituting their profession? :wink:

Oh itā€™s all relative. I think I might have greater reservations working for a Bank or military contractorā€¦ Or not. Ya gotta make a living and folks are pretty good at ā€œcontainerizingā€ the scope of their responsibilities. Itā€™s healthy.

2 Likes

[quote=ā€œbravenel, post:1, topic:38398ā€]
You could build this out of any Arduino / ThingShield pair,
[/quote]I bought the Uno and the ThingShield when I bought my hub, but I never found a use for them so this works out perfectly.

1 Like

Exactly, and Iā€™m not saying itā€™s wrong. Itā€™s just a J.O.B., nothing personal. Thereā€™s no room for pride. Case closed.