New User - Thoughts and Progress

Hello all, new user here - did have Smarthings but never happy with it, hub arrived yesterday and been experimenting ever since (one benefit of early retirement) So far I have got all my LIFX lamps working, presence via phone and Life360, Tado Thermostat, Sonoff Button and Contact, Aqara Contact and Unifi protect video via the dashboard and the image button refreshing the captured stream at 1 sec.

I must admit I was a tad overwhelmed at first and did think "why did I buy this", still trying to get my Lightwaverf switches setup and would love the ability to trigger amazon devices from HE but so far so good, just started looking at rule machine - wow there is a lot to learn there.

The more I experiment the better it gets so onwards towards my goal :slight_smile:

One Question, I'm trying to setup a door left open routine but cant see how to stop the "Door now closed" announcement if the door is opened and closed within the trigger time, any ideas ?

Rule is here :-1

IF (Front Door open(F) [FALSE]) THEN
Speak on Living Room Sonos System: 'The Front Door is open' --> delayed: 0:00:10 (cancelable)
ELSE-IF (Front Door closed(T) [TRUE]) THEN
Speak on Living Room Sonos System: 'The Front Door is now closed'
Cancel Delayed Actions
END-IF

Thanks.

What gen are your switches?
I have gen1 integrated into HE using an rPI.
I don't think anyone has gen 2 working but I may be wrong.

Gen1 so its dooable then ?

Is there an idiots guide to this as I fall into that camp with PI stuff

Yes. I have all my dimmers (6) and outlets (4) running locally on HE using an RPi.

Here is the thread that explains it all with the drivers for the outlets and dimmers.

1 Like

Fantastic - thanks v much

1 Like

I'm being thick here - where do I get the Ras Pi files / guide please ?
Got both hubitat drivers installed OK

It was around 4 years ago when I set up the rPI.
These videos should help, I think.
The main thing to do is read the SmartThings thread that I have linked in above.
The rPI part starts around post 73 below I think.

BTW you can set it up without an rPI using cloud integration.
If you want it all to be local then you need an rPI.
I used to have mine working cloud to cloud on ST.
The drivers for the dimmers and outlets will be different than I have attached to the thread I linked above.

Without a Pi would be fine with me for now :slight_smile:

Hope you get it working OK without the Pi.

Thanks - searching for the cloud drivers now

Have you got outlets or dimmers? Both maybe.

Just Dimmers 2 gang

Not a dimmer but can you get this to work?

import java.security.MessageDigest
 
preferences {
    input("email", "password", title: "Email Address", description: "Your email address")
    input("pin", "password", title: "pin code", description: "Your pin code")
	input("roomID", "text", title: "Room ID", description: "The room id")
    input("deviceID", "text", title: "Device ID", description: "The device id")
}
 
metadata {
	definition (name: "Lightwave Lights", namespace: "smartthings-users", author: "Adam Clark") {
		capability "Switch"
	}

	simulator {}

	tiles {
    
		standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "on", label:'on', action:"on", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"off"
			state "off", label:'off', action:"off", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"on"
		}
        
		main "switch"
		details (["switch"])
	}

}

// parse events into attributes
def parse(String description) {
	log.debug "Parsing '${description}'"
	// TODO: handle 'switch' attribute

}

// handle commands
def on() {
    sendEvent(name: "switch", value: 'off')
    log.debug "Executing 'off'"
    sendCommand(settings.roomID, settings.deviceID, 0)
}

def off() {
    sendEvent(name: "switch", value: 'on')
	log.debug "Executing 'on'"
    sendCommand(settings.roomID, settings.deviceID, 1)
}

def MD5(s) {
	def digest = MessageDigest.getInstance("MD5")
	new BigInteger(1,digest.digest(s.getBytes())).toString(16).padLeft(32,"0")
} 

def timestamp() {
	Calendar.getInstance(TimeZone.getTimeZone('GMT')).getTimeInMillis().toString().substring(0,10)
}

def sendCommand(room, device, status) {

    def params = [
        uri: 'http://lightwaverfhost.co.uk/mobile/getsessionkey.php?email=' + settings.email + '&pin=' + settings.pin,
        headers: [
            'Origin' : 'lightwaverfhost.co.uk',
            'Host'   : 'lightwaverfhost.co.uk'
        ]
    ]

    httpGet(params) {response ->
    	def loginResponse = response.data.toString().tokenize('~')
        def secret = loginResponse[0]
        def mac = loginResponse[1]
        def currentTimestamp = timestamp()
        def commandParams = [
            uri: 'http://lightwaverfhost.co.uk/mobile/writerecord.php',
        	headers: [
                'Origin' : 'lightwaverfhost.co.uk',
                'Host'   : 'lightwaverfhost.co.uk'  
            ],
            body : [
                'signature' : 'JSMobile',
                'secret' : MD5(secret.trim() + currentTimestamp),
                'timestamp' : timestamp(),
                'action' : 'I',
                'email' : settings.email,
                'name' : mac,
                'commandstring' : '!R' + room + 'D' + device + 'F' + status + '|SMARTTHINGS|SMARTTHINGS'
            ]
        ]
        
        httpPost(commandParams) {commandResponse ->
        	log.debug commandResponse.data
        }
        
    }
    
}

Do I load as app code or driver code ?

Do you have a 4 digit pin?
Driver code but I'm not sure it will work.

Yep have pin - just tried on web interface and works fine, setup virtual switch in HE but no joy

Are you getting any errors in the logs?

I'm not sure if someone has said that they have changed their API so this may not work anymore.

Yes I am

dev:672020-11-07 20:33:37.736 errorgroovyx.net.http.HttpResponseException: Not Found on line 69 (off)

dev:672020-11-07 20:33:37.623 debugExecuting 'on'

dev:672020-11-07 20:33:35.673 errorgroovyx.net.http.HttpResponseException: Not Found on line 69 (on)

dev:672020-11-07 20:33:35.548 debugExecuting 'off'