SMS Sending via Simulated Buttons - UK Hive Integration

Continuing the discussion from SmartTiles Dashboard v5.5: Added UK :uk:, 5 × Dashboards, and more! Nov 6, 2015 (www.SmartTiles.click):

Sure, sorry to clog up the SmartTiles topic!

OK folks, so hopefully I can get this going a bit further. As a recap, what I’m trying to do is control the Hive thermostat in the UK, but this device has no direct integration - Hive are saying it operates outside of Zigbee protocols. What it does have is a text gateway, where you can send a limited number of commands to 07860002088 such as HEAT AUTO, HEAT AUTO , HEAT STATUS, HW ON, HW OFF etc.

So to try and get this running from SmartThings (and specifically SmartTiles, although the idea is the same) I started looking at automating it through SMS messages. First up is a way of getting Boost working - which isn’t actually a command you can send yet, but it can be emulated by sending HEAT AUTO 22, and then HEAT AUTO (which will set it to 22, almost guaranteeing it will be turned on, and then the command without the temperature will drop it back into schedule mode).

So firstly I hopped onto the developer site (what do you call that place? The one that starts with graph.api.smartthings.com) and added a new device of type Simulated Button. I then set up a Notify Me When, and asked it to send me a text to the Hive number with the message “HEAT AUTO 22”. Simple, yes?

So here’s the catch. “Notify me when” in SmartThings will send a text message to any number when something happens - YAY! - however it comes from a US number, which Hive rather rudely won’t allow in their whitelist. No rhyme or reason for this, just not allowed. You have to specify what numbers you’re texting from (so they can match your number to your account I imagine) and they all must start with +44, the UK dialling code. So I need a buffer.

At this point, enter IFTTT. IFTTT can sit on my phone (which has a UK outbound number, naturally) and respond to triggers such as an inbound text. I set up the button push to send a message (“heatauto22”) to my phone (which doesn’t care if it receives an international text, which IFTTT is), the IF app then has a rule that listens to Android SMS for a text containing “heatauto22”, and then uses Android SMS to send “HEAT AUTO 22” to the Hive number - which is coming from my UK number, naturally, so it’s fine.

Actually, as I type this I’ve just realised that the ST text number is going to be the same for every user, so if I plumbed that into my Hive I would prevent anyone else from using it as I would have “baggsied” that number. Or, everyone’s Hives would interact with each others. Either way, not great.

I also changed the Simulated Button for a Simulated Switch, as I read something somewhere that a switch can be turned off after x minutes - naturally, I can’t find that anywhere now! Also, IFTTT can interact directly with a switch and not a button (because, I believe, the button flip-flops too fast for IFTTT to detect it) so I can actually skip a section of that - the switch in ST now directly asks my phone to fire off the text, it no longer requires the listener IF running to detect the inbound text.

It then just needs another IFTTT to send the command to stop boosting - which “HEAT AUTO” will do, that will drop back into scheduled mode. This is sent when the switch is turned off again.

TL;DR - Add “Simulated Switch” to ST. When switch on, IFTTT sends a text from my phone to Hive. When Switch Off, it sends a different text.

Won’t work if my phone is out of signal (needs mobile network, the IFTTT signal will use either 4G or WiFi but the outbound SMS needs the good old fashioned mobile network).

To do: work out how to turn the switch off automatically after 60 minutes.
To do then: See if I can somehow get SmartTiles to have the same up/down rockers that are used for other thermostats.

1 Like

Just a thought but do you use Tasker? If you do you could use Sharp Tools which has a Tasker plugin to send the text message from your phone rather than a service number.

Have sharp tools monitor the thing state of your device you’ve created in the ide and then send a text message if this changes.

I think that’s the same as I have IFTTT doing right now, and to be honest I’ve dabbled in Tasker probably once per year since it was a brand new app and I still find it quite unwieldy.
I ditched the inbound-to-phone SMS that I was originally generating (that IFTTT was seeing, and effectively forwarding on) and now I just have a rule that monitors my switch, and then instructs the phone to send an SMS when it’s flicked.

OK, I think I’m done!

The last part of the jigsaw was to turn the switch off after an hour - thus creating a “Boost” button rather than a “Turn the heating on, let me forget about it, waste all my money and turn my house into the centre of a volcano” button.

I went with Rules Machine - Rule machine - as per the app developer, this app is no longer available for new installs, distribution, or support
It was easy to install (Heck, I did it and it worked first time, and sometimes it takes me a few goes to get my shoes the on the correct feet in the morning) and provides a similar sort of approach to IFTTT, but with multiple conditions/triggers and more actions.

I just went ahead and made a new rule that basically said “If the Boost Switch is on, then Turn the Boost Switch off (with a delay of 60 minutes)”. The delay is something native to Rules Machine, so that was nice and simple.

End result is I hit the button, I get a text message from Hive confirming my heating is set to 22 degrees, and then 60 minutes later I get a text saying it’s gone back to whatever my schedule says it should be.

Done.

1 Like