Integration with AT&T digital life

I don’t think the subscribes are needed at all. From what I can see, you should see log output without the subscribes. Do you see the “created … with id …” line? What about “… = …” related to the device state?

Can you post the full Device Type so I can check it out? There could be an issue there as well.

Here is what I get in the log:

6:29:51 PM CST: trace setting device state to closed
6:29:51 PM CST: trace AT&T window1 = closed
6:29:51 PM CST: trace found AT&T window1 with id null already exists
6:29:51 PM CST: debug d = AT&T window1
6:29:51 PM CST: debug window1 : ContactSensor : closed

Here is my device type:

/**
 *  ATT Contact Switch
 *
 *  Copyright 2014 Joe Rosiak
 *
 *  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.
 *
 */
metadata {
	definition (name: "ATT Contact Switch", namespace: "Keo", author: "Joe Rosiak") {
		capability "Contact Sensor"
	}

    simulator {
		// status messages
		status "open":   "zone report :: type: 19 value: 0031"
		status "closed": "zone report :: type: 19 value: 0030"
	}

	// UI tile definitions
	tiles {
		standardTile("contact", "device.contact", width: 2, height: 2) {
		state "open", label: '${name}', icon: "st.contact.contact.open", backgroundColor: "#ffa81e"
		state "closed", label: '${name}', icon: "st.contact.contact.closed", backgroundColor: "#79b821"
	}

	main "contact"
	details "contact"
	}
}

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

def open() {
  sendEvent(name: "ATT Contact Switch", value: "open")
}

def close() {
  sendEvent(name: "ATT Contact Switch", value: "close")
}

Maybe I don’t understand what I am looking at here. Here is what it looks like under Device events:

AT&T WINDOW2 attc ontact switch is open
Name	Value
date	2014-12-02 1:16:27.486 AM UTC (2014-12-02T01:16:27.486Z)
description	AT&T WINDOW2 attc ontact switch is open
deviceId	b0a1d390-e26d-4580-b21d-3a37fef57c6e
deviceTypeId	742dd697-95d2-410b-a3e7-f551448182e8
displayed	true
eventSource	DEVICE
hubId	null
id	d6f2ac1e-79c0-11e4-9ab4-22000a2d0973
isStateChange	true
isVirtualHub	false
linkText	AT&T WINDOW2
locationId	
name	AT&T Contact Switch
rawDescription	
unixTime	1417482987486
value	open
viewed	false

In the DeviceType, change your event sending to be:

sendEvent(name: "contact", value: "open")

and

sendEvent(name: "contact", value: "closed")

You want to use “open” or “closed” as the state per the definitions here: https://graph.api.smartthings.com/ide/doc/capabilities. You want to use “contact” as that is the state that you are trying to set in the device.

You can remove that stuff from the simulator {} section and just leave it empty. I don’t think they are doing anything in this case.

Should I see a current state set inside my devices?

You should see the “Current States” have a value there once it is updating correctly. When it hasn’t been updated once, you may not see it there. You’ll have to refresh the device page of course to see it.

From the logs, it looks like the close function is getting called so changing those sendEvent() functions as I noted above in the DeviceType should set the device state correctly.

I changed the sendEvent as you stated, but it’s still not updating.

Apparently Contact is different than contact. I missed the “C” vs “c”.

So now it’s updating correctly. However it shows:

Current States contact: closed null

I am not sure what the null is.

null generally means that the value is invalid. Did you definitely send “closed” or “open”?

Yeah. I am wondering if there may be a space at the end that is being processed as a variable. I’m look into it and let you know.

Any success in integrating DL devices with SmartThings v2? I just moved and would like to use my old door lock and other sensors at the new place.

I’ve pretty much given up on this. The only way I’ve been able to make things work is setting up email alerts from digital life to go to gmail. Then have IFTTT trigger a SmartThings virtual device on or off. This allowed me to trigger events in SmartThings but the delay with email and IFTTT was too long to be benefital. Then if an email wasn’t generated from digital life the whole thing within ST would be out of sync. Not to mention you have to setup an email alert for each device within digital life. In my case it’s like 20 Windows. That’s a lot of manual entry to have minimal gain.

I’m currently working on implementing a faster-than-ifttt solution. So far, I’m down to 3-15 seconds :slight_smile: and I don’t think there’s much room for improvement other than setting up my own custom mail server and executing things myself.

My approach requires a linux server (can be easily migrated to Windows - it’s just php) - If you have one you’re gold, if not, a raspberry pi can help at a minimal cost (requires no static IP as I poll gmail with IMAP IDLE).

Like you said, lots of “programs” to setup on Digital Life’s application, but I’ve done it. Emails are sent to a dedicated gmail address (dedicated to proxying emails only). My php daemon then connects to the gmail account and waits for emails. I set up some configurable triggers (individual files that specify what fields to match in the email for that trigger to execute) - and I am currently using the IFTTT Maker channel as an endpoint. I don’t yet own a SmartThings but I will soon :wink: and so far, I have my ecobee switch to Away when the DL alarm is set on armed/away and it switches to Home when the alarm is disarmed, also switches to Sleep when the alarm is set to armed/stay. All this is configurable.

Here’s a sample of one of the triggers, hosted in a .conf file inside a triggers.d directory.

[event]
name = “att-dl-dlc-armed-away”
device = “att.dl.dlc”
state = “armed/away”

[action]
endpoint = “ifttt.maker”

[filters]
from = “/^AT&T Digital Life <digitallife.(.*).att-mail.com>/i”
body = “/the digital life system was set to armed-away/i”

I currently have 34 such triggers and the php also maintains virtual devices in a folder structure, each device having a file that contains the current status of the device. I guess there’s not a long way from here to executing an http post to smartthings (I am already posting it to IFTTT using the Maker channel) and I could possibly make it report to both :slight_smile: for added flexibility. The device file structure is good for checking/polling the current state of each device.

If anyone wants more info I’ll be more than happy to share the source code. I’ll probably put it up on github once I get a SmartThings hub and finish the implementation :slightly_smiling:

This is an example of the devices maintained by the app:

.
└── devices
… └── att
… └── dl
… ├── dlc
… ├── front-door
… ├── front-window
… ├── garage-window
… ├── kitchen-door
… ├── kitchen-window
… ├── maria-left-window
… ├── maria-right-window
… ├── master-bathroom-window
… ├── master-center-window
… ├── master-left-window
… ├── master-right-window
… ├── patio-sliding-door
… ├── stephanie-left-window
… ├── stephanie-right-window
… └── utility-door

The device name in the trigger .conf files is parsed into a folder structure att > dl (digital life) > dlc (digital life controller). I built this with more providers/devices in mind, hence the folder structure.

The content of ./devices/att/dl/dlc is armed/away
The content of ./devices/att/dl/front-door is closed

Each of the devices above has at least two “programs” in AT&T Digital Life’s app (doors and windows have two, the dlc has about 5, the smoke detector I haven’t setup yet (need to catch an email to build the regexp for filter matching), same goes for the motion detector (not sure yet if this reports movement even when the alarm is disarmed - haven’t tested that yet)

NOTE: There is currently NO way that I am aware of to actually arm/disarm the DL alarm using an external trigger, other than the phone app or the online portal. I have an idea and will update you if it works :wink:

Adrian

1 Like

UPDATE: Managed to connect to Digital Life and am now getting a full list of devices (including battery level!) and can get/set system status. Yes, I can arm the alarm programmatically.

Note: I’ve x’d out numbers for security purposes.

Example of devices:

[att.dl.digital-life-system] => stdClass Object
    (
        [deviceType] => digital-life-system
        [deviceGuid] => AM0000xxxx
        [movable] => 1
        [events] => ac-power-lost,ac-power-restored,recent-closing-alarm,exit-alarm,device-log-event,alarm-condition,alarm-condition-cleared,alarm-pending,pending-alarm-condition-cleared,alarm-condition-confirmed,home-disarmed,away-armed,stay-armed,home-disarmed-bypass,instant-armed,system-status,police,fire,aux
        [entry-device-list] => SD0A09xxxx,SD0A09xxxx,SM0402xxxx
        [command] => null
        [camera-exclusion-list] => null
        [command-result] => Ack!User=17926xxxx[Desktop Web:1457114467484]!
        [alarmed-device-list] => null
        [agentcameraexclusionlist] => null
        [alarm-timeout] => 300
        [system-status] => **Away**
        [exit-delay] => 45
        [alarmed-device.event-list] => null
        [abort-delay] => 45
        [entry-delay] => 30
        [armed-stay-device-list] => SD0A09xxxx,SD0A17xxxx,SD0A09xxxx,SD0A19xxxx,SD0A01xxxx,SD0A17xxxx,SD0A19xxxx,SD0A19xxxx,SD0A09xxxx,SD0A17xxxx,SD0A30xxxx,SD0A2Bxxxx,SD0A2Exxxx,SD0A3Axxxx
        [information-notifications] => null
        [alarm-mode] => home
        [armed-instant-device-list] => SD0A09xxxx,SD0A09xxxx,SD0A09xxxx,SD0A17xxxx,SD0A19xxxx,SD0A17xxxx,SD0A17xxxx,SD0A01xxxx,SD0A19xxxx,SD0A19xxxx,SD0A30xxxx,SD0A2Bxxxx,SD0A2Exxxx,SD0A3Axxxx
        [24hrdevicelist] => null
        [alarm-notifications] => null
        [cross-zoning-delay] => 15
        [swinger-shutdown-count] => 2
        [am-flags] => 3837
        [status] => 0
        [name] => Digital Life System
        [bypassed-device-list] => null
        [armed-away-device-list] => SD0A09xxxx,SD0A17xxxx,SD0A09xxxx,SD0A19xxxx,SD0A01xxxx,SD0A17xxxx,SD0A19xxxx,SD0A19xxxx,SD0A09xxxx,SD0A17xxxx,SM0402xxxx,SD0A30xxxx,SD0A2Bxxxx,SD0A2Exxxx,SD0A3Axxxx
    )
[att.dl.front-window] => stdClass Object
    (
        [deviceType] => contact-sensor
        [deviceGuid] => SD0A17xxxx
        [movable] =>
        [events] => tamper,tamper-restore,loss-of-power,loss-of-power-restore,device-log-event,online,offline,battery-low,battery-low-restore,opened,closed
        [arm-state] => **armed**
        [status] => 0
        [name] =>** Front Window**
        [contact-state] => **closed**
        [signal-strength] => 0
        [battery-level] => 10
        [test-mode-expiry] => null
        [location] => 000300xxxx
    )
[att.dl.front-door] => stdClass Object
    (
        [deviceType] => contact-sensor
        [deviceGuid] => SD0A09xxxx
        [movable] =>
        [events] => tamper,tamper-restore,loss-of-power,loss-of-power-restore,device-log-event,online,offline,battery-low,battery-low-restore,opened,closed
        [arm-state] => **armed**
        [status] => 0
        [name] => **Front Door**
        [contact-state] => **closed**
        [signal-strength] => 0
        [battery-level] => 90
        [test-mode-expiry] => null
        [location] => 000300xxxx
    )

Best part yet, I get real time events from the DL:

{“dev”:“AM0000xxxx”,“subsid”:“xxxx”,“domain”:“DL”,“value”:“Ack!User=17926xxxx[Desktop Web:1457114467484]!”,“label”:“command-result”,“type”:“device”,“catid”:“0001070100xxxx”,“acc”:“xxxx”,“extaccid”:“xxxx”,“key”:“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”,“mbus”:“true”}“”"

{“dev”:“AM0000xxxx”,“subsid”:“xxxx”,“domain”:“DL”,“value”:“Home ExitDelay”,“label”:“system-status”,“type”:“device”,“catid”:“0001070100xxxx”,“acc”:“xxxx”,“extaccid”:“xxxx”,“key”:“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”,“mbus”:“true”}“”"

{“dev”:“AM0000xxxx”,“subsid”:“xxxx”,“domain”:“DL”,“value”:“Away”,“label”:“system-status”,“type”:“device”,“catid”:“0001070100xxxx”,“acc”:“xxxx”,“extaccid”:“xxxx”,“key”:“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”,“mbus”:“true”}“”"

{“dev”:“0”,“subsid”:“xxxx”,“sdev”:“AM0000xxxx”,“domain”:“DL”,“label”:“notification-event”,“type”:“event”,“acc”:“xxxx”,“extaccid”:“xxxx”,“key”:“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”,“mbus”:“true”}“”"

{“dev”:“AM0000xxxx”,“subsid”:“xxxx”,“sdev”:“0”,“domain”:“DL”,“label”:“away-armed”,“type”:“event”,“catid”:“0001070100xxxx”,“acc”:“xxxx”,“extaccid”:“xxxx”,“key”:“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”,“mbus”:“true”}“”"

The subsid above is the subscriber ID (phone number of the SIM card inside the DLC)
The key is retrieved during login - unique to the DLC (not per connection, remains the same at all times)

Events are delivered as JSON objects via a keep-alive HTTPS connection. The email solution above was not working as designed because of missing emails. I guess I can remove all the “programs”… :blush:

1 Like

Ironically, I found this site after I fought my way through their portal :slightly_smiling:

https://dl-hackathon.com/s/quickstart.html

I built this in PHP, they list some code there too. I’m essentially using the same approach. I need a SmartThings hub now…

1 Like

This is very good news. Unfortunately I am not a developer ( More of a hacker ). Is this code that runs on another device such as a raspberri pi or mac?

Yes, I have since converted it to node.js and therefore can run on my Mac, on a Raspberry PI or perhaps even on my Synology NAS :slight_smile: (haven’t tried it yet - that NAS can’t get past version 0.10 for node.js). It requires node.js and the request module.

I will update you when I get a SmartThings hub - can’t develop for it without one :slightly_smiling:

Here’s a sample of the node.js console log:

EVENT: Device “Kitchen Door” changed its “contact-state” value from “closed” to “open”
EVENT: Device “Digital Life System” changed its “alarmed-device-list” value from “” to “SD0A09xxxx,”
EVENT: Device “Digital Life System” changed its “alarmed-device.event-list” value from “” to “SD0A09xxxx.1090,”
EVENT: Device “Digital Life System” changed its “system-status” value from “Stay” to “Stay PendingAlarm”
EVENT: Device “Kitchen Door” changed its “contact-state” value from “open” to “closed”
EVENT: Device “Digital Life System” changed its “alarmed-device-list” value from “SD0A09xxxx,” to “”
EVENT: Device “Digital Life System” changed its “alarmed-device.event-list” value from “SD0A09xxxx.1090,” to “”
EVENT: Device “Digital Life System” changed its “system-status” value from “Stay PendingAlarm” to “Home”
EVENT: Device “Patio Sliding Door” changed its “contact-state” value from “closed” to “open”
EVENT: Device “Kitchen Door” changed its “contact-state” value from “closed” to “open”

The line pops on the console within 1 second of the event happening - I call that real time. The “armed” event comes before the alarm does its final long beep :smiley:

1 Like

I have digital life and I moved my Yale door lock from digital life and reset it and added to smartthings

Is AT&T still charging you the $5/mo for the door package? The only controllable device I have from AT&T is the actual DLC (arm/disarm). I have no door lock, so I haven’t implemented it. Though that should not be hard to do. I am currently testing my AT&T integration, but it requires an external server (external as in other than the ST hub or the DLC) and the server setup is pretty complex. But it works pretty nice. It can actually be integrated into ST alone, but it would then be a polling service and I don’t know how much AT&T would like that (i.e. connecting to them every few seconds), unless one does not need immediate updates and can live with one update every few minutes…