How to enable SMS


#1

I’m trying to build a new piston that will send me an SMS when a button is pressed. I’ve looked through the Wiki, the install guide, the forums, etc and it seems like it’s possible to do, but when I look under actions I don’t have any SMS options.


#2

If you have a US based number, you can click on
+ add a new task

and then use this as a template:

pic


Note: If you do not see
+ add a new task
in the right section, then first create a container, like:

  • + add a new statement
  • Add an action
  • Add a task
  • Then use the template above.

#3

This only works with the SmartThings version of webCoRE. Hubitat does not support SMS, so by default webCoRE on that platform does not support SMS.


#4

Tagging @E_Sch


#5

Sorry, I did not realize that the OP was a HE user… Changing the category now.


#6

This is correct. If you use or email provider that does email-> SMS, or use various notification apps is workaround.

this is described in the first couple of notes in the webcore posting in HE forum.


#7

Just curious… With HE, is there a daily limit on emails, like there is with SmartThings?


#8

Would assume yes, the webCoRE groovy code shares the same email endpoint for both HE & ST.


#9

That did it, thank you so much!


#10

Sorry, my comment on SMS and Hubitat was generic on this topic. However, I did migrate almost everything to Hubitat the last 45 days from SmartThings, but still have my Samsung TVs, Arlo cameras, and Logitech remote buttons on ST.

So not to really over complicate things or telegraph a solution to use, I do enjoy SMS messaging on both platforms.

My only remaining piston (sadly) on ST is the following:

Which is used by a Hubitat DH that I use with Hubitat webCoRE and Rule engine:

/**
 *  Copyright 2020 Bloodtick Jones
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *  Virtual Text Speaker
 *
 *  Author: bloodtick
 *  Date: 2020-08-24
 */
metadata {
	definition (name: "Virtual Text Speaker", namespace: "bloodtick", author: "Hubitat", ocfDeviceType: "x.com.st.d.siren") {
		capability "Actuator"
        capability "Speech Synthesis"
        capability "Notification"
	}
    preferences {
		input(name:"endpoint", type:"string", title:"API Endpoint", defaultValue:"https://...", required:true)
		input(name:"number", type:"string", title:"Text Number", defaultValue:"", required:true)
        input(name:"duplicate", type: "number", title: "Debounce Delay (secs)", range: "0...600", defaultValue: 10, required: false)
    }
}

def parse(String description) {
    log.debug description
}

def deviceNotification(String msg) {
    speak(msg)
}

def speak(String msg) { 
    if (endpoint && number && msg!=state?.msg) {
        log.info "Sending '$msg' to '$number'"
        sendPostCommand( endpoint, [ task: 'text', text: msg, number: number ] )        
        state.msg = msg        
        if (duplicate)
            runIn(duplicate, clear)
    }
    else {
        if (msg==state.msg)
            log.info "Duplicate '$msg'"
        else
            log.error "Endpoint and/or number is not configured"
    }
}

def clear() {
    state.msg = ''
}

def sendPostCommand(uri, data) {
	def requestParams =
	[
		uri: uri,
		requestContentType: "application/json",
        body: data,
		timeout: 20
	]

	try
	{
		httpPostJson(requestParams)
		{
	  	  response ->
			if (response?.status == 200)
			{
				return response.data
			}
			else
			{
				log.error "httpPostJson() request failed with error ${response?.status}"
				return [status: "error", message: "httpPostJson() request failed with status code ${response?.status}"]
			}
		}
	}
	catch (Exception e)
	{
		log.error "httpPostJson() failed with error ${e.message}"
		return [status: "error", message: e.message]
	}
}

#11

Excellent.

Is it safe to assume that you are using SmartThings… not Hubitat?