SmartThings Community

[RELEASE] ST_Anything v2.9.2 - Arduino/ESP8266/ESP32 to ST via ThingShield, Ethernet, or WiFi

arduino
alarm
dth_misc
esp8266
esp32

(Dan) #2148

The sketch looks fine to me at first glance. Sounds like the issue would be on the ST IDE Groovy DTH side, right?


(L B) #2149

I have that set to parent st Ethernet.

Should I delete the device and add again?


(Dan) #2150

Not sure. The children are all created? Is the Parse() function of the parent or child device throwing the error?


#2151

How did you install the child and parent DTH into the IDE? Did you use GitHub integration or did you copy/paste? If you copy/pasted did you confirm you didn’t chop off a line and/or copy the formatted text instead of the “raw” file?


(L B) #2152

GitHub. I’m going to delete and install the device again.


#2153

And you have all the DTHs installed? Both the Parent and all the child devices?


(L B) #2154

All the ones that I could check on GitHub


(L B) #2155

ogiewon : Child Alarm DanielOgorchock/ST_Anything (master) Published Actuator, Alarm, Switch
ogiewon : Child Carbon Monoxide Detector DanielOgorchock/ST_Anything (master) Published Carbon Monoxide Detector, Sensor, Smoke Detector
ogiewon : Child Contact Sensor DanielOgorchock/ST_Anything (master) Published Contact Sensor, Sensor
ogiewon : Child Dimmer Switch DanielOgorchock/ST_Anything (master) Published Actuator, Relay Switch, Sensor, Switch, Switch Level
ogiewon : Child Door Control DanielOgorchock/ST_Anything (master) Published Actuator, Contact Sensor, Door Control, Garage Door Control, Momentary, Sensor
ogiewon : Child Generic Sensor DanielOgorchock/ST_Anything (master) Published Sensor
ogiewon : Child Humidity Sensor DanielOgorchock/ST_Anything (master) Published Relative Humidity Measurement, Sensor
ogiewon : Child Illuminance Sensor DanielOgorchock/ST_Anything (master) Published Illuminance Measurement, Sensor
ogiewon : Child IlluminanceRGB Sensor DanielOgorchock/ST_Anything (master) Published Illuminance Measurement, Sensor
ogiewon : Child Motion Sensor DanielOgorchock/ST_Anything (master) Published Motion Sensor, Sensor
ogiewon : Child Power Meter DanielOgorchock/ST_Anything (master) Published Power Meter, Sensor
ogiewon : Child Presence Sensor DanielOgorchock/ST_Anything (master) Published Presence Sensor, Sensor
ogiewon : Child Pressure Measurement DanielOgorchock/ST_Anything (master) Published Sensor
ogiewon : Child Relay Switch DanielOgorchock/ST_Anything (master) Published Actuator, Relay Switch, Sensor, Switch
ogiewon : Child RGB Switch DanielOgorchock/ST_Anything (master) Published Actuator, Color Control, Light, Sensor, Switch, Switch Level
ogiewon : Child RGBW Switch DanielOgorchock/ST_Anything (master) Published Actuator, Color Control, Light, Sensor, Switch, Switch Level
ogiewon : Child Servo DanielOgorchock/ST_Anything (master) Published Actuator, Sensor, Switch Level
ogiewon : Child Smoke Detector DanielOgorchock/ST_Anything (master) Published Sensor, Smoke Detector
ogiewon : Child Switch DanielOgorchock/ST_Anything (master) Published Actuator, Relay Switch, Sensor, Switch
ogiewon : Child Temperature Sensor DanielOgorchock/ST_Anything (master) Published Sensor, Temperature Measurement
ogiewon : Child Ultrasonic Sensor DanielOgorchock/ST_Anything (master) Published Sensor
ogiewon : Child Voltage Sensor DanielOgorchock/ST_Anything (master) Published Sensor, Voltage Measurement
ogiewon : Child Water Sensor DanielOgorchock/ST_Anything (master) Published Sensor, Water Sensor
ogiewon : Parent_ST_Anything_Ethernet DanielOgorchock/ST_Anything (master) Published Button, Configuration, Holdable Button, Refresh, Signal Strength
ogiewon : Parent_ST_Anything_Thingshield DanielOgorchock/ST_Anything (master) Published Button, Configuration, Holdable Button, Refresh


(L B) #2156

i deleted the device twice and reinstalled. The first time it installed 2 child devices for contact 3


(L B) #2157

Here is what I see when I try to open and close some contacts.

8:41:12 PM: error java.lang.NullPointerException @line 56 (parse)

05a55c27-6757-497f-b062-dfb0fef1c068 8:41:12 PM: debug parse(contact closed) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:12 PM: debug 060203040506-contact3 - name: contact, value: closed

a822af67-1df8-4028-8f0c-8459a391724d 8:41:12 PM: debug Parsing: contact3 closed

05a55c27-6757-497f-b062-dfb0fef1c068 8:41:12 PM: debug parse(contact closed) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:12 PM: debug Parsing: contact3 closed

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:10 PM: error java.lang.NullPointerException @line 56 (parse)

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:10 PM: debug parse(contact closed) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:10 PM: debug 060203040506-contact1 - name: contact, value: closed

a822af67-1df8-4028-8f0c-8459a391724d 8:41:10 PM: debug Parsing: contact1 closed

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:10 PM: error java.lang.NullPointerException @line 56 (parse)

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:10 PM: debug parse(contact open) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:10 PM: debug 060203040506-contact1 - name: contact, value: open

a822af67-1df8-4028-8f0c-8459a391724d 8:41:10 PM: debug Parsing: contact1 open

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:10 PM: debug parse(contact open) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:10 PM: debug Parsing: contact1 open

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:09 PM: error java.lang.NullPointerException @line 56 (parse)

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:09 PM: debug parse(contact open) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:09 PM: debug 060203040506-contact1 - name: contact, value: open

a822af67-1df8-4028-8f0c-8459a391724d 8:41:09 PM: debug Parsing: contact1 open

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:09 PM: error java.lang.NullPointerException @line 56 (parse)

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:09 PM: debug parse(contact closed) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:09 PM: debug 060203040506-contact1 - name: contact, value: closed

a822af67-1df8-4028-8f0c-8459a391724d 8:41:09 PM: debug Parsing: contact1 closed

a822af67-1df8-4028-8f0c-8459a391724d 8:41:08 PM: debug 060203040506-contact1 - name: contact, value: open

a822af67-1df8-4028-8f0c-8459a391724d 8:41:08 PM: debug Parsing: contact1 open

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:08 PM: error java.lang.NullPointerException @line 56 (parse)

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:08 PM: debug parse(contact open) called

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:08 PM: debug parse(contact open) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:08 PM: debug Parsing: contact1 open

a822af67-1df8-4028-8f0c-8459a391724d 8:41:08 PM: debug 060203040506-contact1 - name: contact, value: closed

a822af67-1df8-4028-8f0c-8459a391724d 8:41:08 PM: debug Parsing: contact1 closed

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:08 PM: error java.lang.NullPointerException @line 56 (parse)

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:08 PM: debug parse(contact closed) called

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:08 PM: error java.lang.NullPointerException @line 56 (parse)

60ff3846-06b8-4a7b-826f-adc58853aa0d 8:41:08 PM: debug parse(contact open) called

a822af67-1df8-4028-8f0c-8459a391724d 8:41:08 PM: debug 060203040506-contact1 - name: contact, value: open

a822af67-1df8-4028-8f0c-8459a391724d 8:41:08 PM: debug Parsing: contact1 open


(Dan) #2158

If these errors are coming from the Child Device, and not the Parent Device (select the devices at the top of the live logging session to see which one is doing it)

Here is line 56 from the Child Device…

def nowDay = new Date().format("MMM dd", location.timeZone)

Not sure why that would be throwing an error after all this time of working without any issue. Is your TimeZone set correctly for your hub?


(L B) #2159

I just checked and somehow my hub was moved to Europe… Funny thing is it was my location… Works perfect now… Thanks!


(L B) #2160

One last question, can I speed up the refresh in the app for status? It takes a while to reflect status unless I click on the child and it then updates.


(Dan) #2161

Glad to hear you got the location/timezone sorted out. That was a strange one. I just fired up a MEGA + W5100 as a quick test and could not reproduce the problem, so I am glad you found it.

The update rate of the ST Mobile Phone App? Nope, that is not within any of our control. But, the good news is that the display in the app really does not matter too much. All decisions are done in the ST Cloud, using App like Smart Lighting and webCoRE. The mobile app on the phone is just a display for most devices, except switches and dimmers.


(L B) #2162

I would like the output to show on/ off instead of open/ closed for some things. Is there child device I could use to show that status?


(Dan) #2163

You can try this modified Child DTH that I use for a special purpose (monitoring my Heat Pump system). I too wanted to monitor a digital input pin using an IS_Contact device but then report within Hubitat as a switch device (i.e. On/Off) for readability. Simply manually add this DTH to your ST IDE, save and publish it. Then, manually change the Device Type of the child devices from “Child Contact Sensor” to this custom device.

/**
 *  Child HVAC Switch
 *
 *  Copyright 2017 Daniel Ogorchock
 *
 *  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.
 *
 *  Change History:
 *
 *    Date        Who            What
 *    ----        ---            ----
 *    2017-04-10  Dan Ogorchock  Original Creation
 *    2017-08-23  Allan (vseven) Added a generateEvent routine that gets info from the parent device.  This routine runs each time the value is updated which can lead to other modifications of the device.
 *    2018-06-02  Dan Ogorchock  Revised/Simplified for Hubitat Composite Driver Model
 *
 * 
 */
metadata {
	definition (name: "Child HVAC Switch", namespace: "ogiewon", author: "Dan Ogorchock") {
		capability "Switch"
		capability "Sensor"

		attribute "lastUpdated", "String"
	}

	simulator {

	}

	tiles(scale: 2) {
		multiAttributeTile(name:"switch", type: "lighting", width: 3, height: 4, canChangeIcon: true){
			tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
				attributeState "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState:"turningOn"
				attributeState "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00A0DC", nextState:"turningOff"
				attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00A0DC", nextState:"turningOff"
				attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
			}
 			tileAttribute("device.lastUpdated", key: "SECONDARY_CONTROL") {
    				attributeState("default", label:'    Last updated ${currentValue}',icon: "st.Health & Wellness.health9")
            }
		}
	}
}

def on() {
    //sendData("on")
}

def off() {
    //sendData("off")
}

def sendData(String value) {
    def name = device.deviceNetworkId.split("-")[-1]
    parent.sendData("${name} ${value}")  
}

def parse(String description) {
    //log.debug "parse(${description}) called"
	def parts = description.split(" ")
    def name  = parts.length>0?parts[0].trim():null
    def value = parts.length>1?parts[1].trim():null
    if (name && value) {
        // Update device
        name = "switch"
        if (value == "open") { value = "off" }
        if (value == "closed") { value = "on" }               
        sendEvent(name: name, value: value)
        // Update lastUpdated date and time
        def nowDay = new Date().format("MMM dd", location.timeZone)
        def nowTime = new Date().format("h:mm a", location.timeZone)
        sendEvent(name: "lastUpdated", value: nowDay + " at " + nowTime, displayed: false)
    }
    else {
    	log.debug "Missing either name or value.  Cannot parse!"
    }
}

def installed() {
}

(L B) #2164

This works great. Is there a way to edit the code so you cant push a button showing turning on or off?


#2165

Any of the sensor DTH can’t be “pushed” or changed except by the device. You can try this one that I used for my power sensor.

/**
 *  Child Power Sensor
 *
 *  Copyright 2018 Ryan Casler
 *
 *  
 */
metadata {
	definition (name: "Child Power Sensor", namespace: "ryancasler", author: "Ryan Casler") {
		capability "Contact Sensor"
		capability "Sensor"

		attribute "lastUpdated", "String"
	}

	tiles(scale: 2) {
		multiAttributeTile(name:"contact", type: "generic"){
			tileAttribute ("device.contact", key: "PRIMARY_CONTROL") {
				attributeState "open", label:'power failure', icon:"st.alarm.alarm.alarm", backgroundColor:"#ff0000"
				attributeState "closed", label:'normal', icon:"st.security.alarm.clear", backgroundColor:"#79b821"            
				}
 			tileAttribute("device.lastUpdated", key: "SECONDARY_CONTROL") {
    				attributeState("default", label:'    Last updated ${currentValue}',icon: "st.Health & Wellness.health9")
            }
        }
	}

}

def parse(String description) {
    log.debug "parse(${description}) called"
	def parts = description.split(" ")
    def name  = parts.length>0?parts[0].trim():null
    def value = parts.length>1?parts[1].trim():null
    if (name && value) {
        // Update device
        sendEvent(name: name, value: value)
        // Update lastUpdated date and time
        def nowDay = new Date().format("MMM dd", location.timeZone)
        def nowTime = new Date().format("h:mm a", location.timeZone)
        sendEvent(name: "lastUpdated", value: nowDay + " at " + nowTime, displayed: false)
    }
    else {
    	log.debug "Missing either name or value.  Cannot parse!"
    }
}

def installed() {
}

You can modify the words by changing what’s after “label” in the attribute state in the meta data at the top.


(Dan) #2166

Pushing the button shouldn’t do anything since the on() and off() functions’s contents are commented out. Feel free to hack away at the child DTH to make it work however you’d like.


#2167

But the one you posted had the “switch” capability, so wouldn’t that imply an “on/off” control from the ST app and not just a sensor?