Particle Photon logging to GroveStreams

I have a particle photon that I’m using to detect when my boiler is heating. The boiler has an LED indicator to signify when it is heating so I’m using the photon with a light dependent resistor to send that information to smartthings. I have grovestreams setup and it is working for everything I have so far (i.e. temp, power, etc) but when I add this boiler indicator it does not get logged it never shows up in the grovestream web app.

below is my device handler based very much on @baconface, so thanks!

/*
*  Boiler Status
*
*  Copyright 2018 by Shane Rock
*
*  This SmartThings device handler integrates a Particle (Photon in my case) to monitor boiler status.
*
*  A WebCoRE piston calls the refresh() function to update the door statuses in SmartThings when a state 
change 
*  is published from the Particle Sketch.
*/

metadata {
definition (name: "Boiler Status", namespace: "shanerock", author: "Shane Rock") {
    //capability "Boiler Status"
    // capability "actuator"
    //capability "contact sensor"
    capability "Switch"
    capability "Polling"
    capability "Sensor"
    capability "Refresh"
    
    attribute "boilerStatus", "string"  // Defines a container to hold the state of your boiler
}

preferences {
input name: "deviceId", type: "text", title: "Device ID", required: true      // Photon device ID from build.particle.io (you'll put this in the settings) 
input name: "token", type: "password", title: "Access Token", required: true  // Photon super secret access token you get from build.particle.io
input name: "boilerStatus", type: "text", title: "Boiler Status Variable Name", required: false, defaultValue: "boilerStatus"  // These three lines define the name of the variable
}

tiles(scale: 2) {
	// Defines tiles that will appear on the device page
	standardTile("boilerStatus", "device.boilerStatus", width: 6, height: 2, inactiveLabel: false, decoration: "flat") {
			state "false", label: "Idle", icon: "st.thermostat.heating-cooling-off", backgroundColor: "#83ED5B"
			state "true", label: "Heating", icon: "st.thermostat.heating", backgroundColor: "#FF5733"
	}
    standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
        state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
    }

	main (["boilerStatus"])  // This is the tile that will show up on the device's preview.
}

}


def poll() {  // Polls for the status of the garage doors
log.debug "Executing 'poll'"
getStatus()
}

def refresh() {  // Calls the garage status functions to refresh them upon refresh button press
log.debug "Executing 'refresh'"
getStatus()
}

// no clue what this does or if its needed
def parse(String description) {
def pair = description.split(":")

createEvent(name: pair[0].trim(), value: pair[1].trim())
}

// How we pull the status from Particle
private getStatus() {
def closure = { response ->
    log.debug "request was successful, $response.data"

    sendEvent(name: "boilerStatus", value: response.data.result)
}

httpGet("https://api.particle.io/v1/devices/${deviceId}/${boilerStatus}?access_token=${token}", closure)
}

Are you seeing your variable change on console.particle.io when the boiler indicator goes on/off?

yes everything is working on console.particle.io and even in smartthings it changes but after I added the “boiler” switch device in the grovestream smartapp it never gets sent to grovestream

Just wanted to let anyone know that I got this working by modifying the device handler slightly as follows:

/*
 *  Boiler Status
 *
 *  Copyright 2018 by Shane Rock
 *
 *  This SmartThings device handler integrates a Particle (Photon in my case) to monitor boiler status.
 *
 *  A WebCoRE piston calls the refresh() function to update the door statuses in SmartThings when a state change 
 *  is published from the Particle Sketch.
*/

metadata {
    definition (name: "Boiler Status", namespace: "shanerock", author: "Shane Rock") {
        //capability "Boiler Status"
        // capability "actuator"
        //capability "contact sensor"
        capability "Switch"
        //capability "Polling"
        //capability "Sensor"
        capability "Refresh"
        
        attribute "boilerStatus", "string"  // Defines a container to hold the state of your boiler
    }

preferences {
    input name: "deviceId", type: "text", title: "Device ID", required: true      // Photon device ID from build.particle.io (you'll put this in the settings) 
    input name: "token", type: "password", title: "Access Token", required: true  // Photon super secret access token you get from build.particle.io
    input name: "boilerStatus", type: "text", title: "Boiler Status Variable Name", required: false, defaultValue: "boilerStatus"  // This line define the name of the variable
    }

    tiles(scale: 2) {
    	// Defines tiles that will appear on the device page
   		standardTile("boilerStatus", "device.boilerStatus", width: 6, height: 2, inactiveLabel: false, decoration: "flat") {
				state "false", label: "Idle", icon: "st.thermostat.heating-cooling-off", action: "switch.off", backgroundColor: "#83ED5B"
				state "true", label: "Heating", icon: "st.thermostat.heating", action: "switch.on", backgroundColor: "#FF5733"
		}
        standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
        }

		main (["boilerStatus"])  // This is the tile that will show up on the device's preview.
    }

}


def poll() {  // Polls for the status of the garage doors
    log.debug "Executing 'poll'"
    getStatus()
}

def refresh() {  // Calls the garage status functions to refresh them upon refresh button press
    log.debug "Executing 'refresh'"
    getStatus()
}

// no clue what this does or if its needed
def parse(String description) {
    def pair = description.split(":")

    createEvent(name: pair[0].trim(), value: pair[1].trim())
}

//	sendEvent(name: "switch", value: "on")

//	sendEvent(name: "switch", value: "off")

// How we pull the status from Particle
private getStatus() {
    def closure = { response ->
        log.debug "request was successful, $response.data"
		log.debug "value is, $response.data.result"
        if ("$response.data.result" == "false"){
        	sendEvent(name: "switch", value: "off")
        }
        else if ("$response.data.result" == "true"){
        	sendEvent(name: "switch", value: "on")
        }
        
        sendEvent(name: "boilerStatus", value: response.data.result)
    }

    httpGet("https://api.particle.io/v1/devices/${deviceId}/${boilerStatus}?access_token=${token}", closure)
}
1 Like