I’m working on a simple Arduino/ThingShield device that monitors the lights on my washer/dryer. The goal is to be alerted when the washer/dryer are finished. The hardware is simple enough: A photocell for the “done” LED on the washer, and another on the dryer.
For my device type, I added two custom attributes: washerLightState and dryerLightState. The problem I have now is actually setting up the rest of the device type. While there are at least some docs for writing SmartApps, there seems to be very little for writing device types – it’s all based on examples, really, and it’s not necessarily clear what to use where and why.
This is also my first exposure to Groovy, although I’ve found it easy enough to follow; I’m mostly a C programmer with some dabbling in Objective C, C++, Python, Javascript, HTML.
Some of my questions:
-
What is “Join Fingerprints” entry when creating a new device type? I’m guessing it’s something I don’t need to worry about, but I’m curious.
-
I want to have the tiles for my device change from white when the washer/dryer is not yet done running, and to blue when the washer finishes and red when the dryer finishes. For both I would also like to display “Waiting” or “Done” on the tile. Should I be using standardTile or valueTile or that? It seems that a standardTile is commonly used as a “button” to change state, but it’s not clear to me if valueTiles can change color or not. I’m trying to use “Shield On/Off (Example)” as a reference, but it isn’t clear why one tile is chosen over the other for the “greeting” and “message” tiles, and tapping the “greeting” tile doesn’t seem to actually do anything.
-
It seems you can pick any of the icons for the tile when defining it, and I noticed that washer/dryer icons do exist in the SmartThings iOS app. However, it’s not obvious how to figure out the names for those icons. I’d like an image of a washer on one tile and a dryer on the other, for obvious reasons. Is there some API to get that?
-
I have no idea what this means:
simulator {
status "on": "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6E"
status "off": "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6666"
// reply messages
reply "raw 0x0 { 00 00 0a 0a 6f 6e }": "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6E"
reply "raw 0x0 { 00 00 0a 0a 6f 66 66 }": "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6666"
}
I get that this is for setting up the device for use in the simulator. I sort of get the “status” lines. I’m less clear on what “reply” is doing, though, and I don’t know what the catchall: line is at all (I mean, beyond some kind of exception handling, I think? I don’t know what the numbers are meant to represent represent).
The IR Bridge project implies that the simulator block can just be empty if I don’t want to be able to test it in the simulator, I think…
- It’s not totally clear to me what parse() is doing, although I think i’ve figured out most of it. It seems that it’s only used to process events that come from the device (ThingShield), with “description” being an arbitrary string from said device. The IR Bridge project implies that you can return an array by using createEvent() builders, rather than just a single event. In that event structure, it seems that “name” is the name of the attribute, handlerName is the closure/function/whatever to be executed when to handle the event, and isStateChange is true if the state of the attribute has changed. It’s not entirely clear how descriptionText and linkText are used exactly, or what displayed is actually indicating…
I don’t really understand what the def value = zigbee.parse(description)?.text
line is doing – what zigbee.parse() is needed for, and why it is calling .text to presumably return the result as a string. What is it parsing? I guess “description” isn’t the raw string from the device?
-
I think the on(), off(), etc. functions are handling events (as returned by parse() as handlerName), but the zigbee.smartShield() method (such as
zigbee.smartShield(text: "on").format()
) has no obvious documentation, nor is it clear what the format() method is for. -
The IR Builder project makes use of sendEvent(). It’s not clear to me what this is doing, exactly; I think it may be so you can send an event outside of parse(), and that the events returned by parse() are executed through sendEvent() internally, or something like that?
I’m really interested in knowing WHY these examples are doing all of this stuff, what all the members of the classes are, what the functions being called do and why they are needed. I could bang away at this and just make guesses until it works, but I really don’t like working that way.
I know documentation is on the list of things to do, but just (very) heavily documenting the example/tutorial code would go a long way helping makers understand how to build their own projects in the meantime.
Thanks!
– Joe