Hello, Looking for a little help with code. I have never written code before and looking to make a smartapp. I have been reading the documentation and thought I would give it a shot. What this app does is pulls the temperature from a sensor and changes the color of a bulb to match the degrees. I think I have a good handle on it but I keep getting errors when I try to save and doesn’t really tell me what is the problem. I’m not completely done with it but I need to get back to work. I’m still researching the color codes for the bulb so I know they are not correct but any help anyone could provide or any advice would be appreciated.
definition(
name: “Temperature Bulb”,
namespace: “tagz379”,
author: “Joe Battaglia”,
description: “Change color of bulb based on temperature”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)
preferences {
section (“Sensor”) {
input “sensor1”, “capability.temperaturemeasurement”,
title: “Where?” }
section ("Bulb") {
input "bulb", "capability.colorcontorl",
title: "Bulb" }
def initialize() {
subscribe (sensor1, “sensor”, sensorHandler)}
def sensorHandler(evt) {
log.debug “$evt.value”
if (evt.value == "10") {
bulb.on();
bulb.sethue(80);
bulb.setsaturation(50);
bulb.setlevel(80); }
else if (evt.value == "20" {
bulb.on();
bulb.sethue(70);
bulb.setsaturation(40);
bulb.setlevel(80); }