[RELEASE] Unlimited customizable thermostat

customizable
ultimate
thermostat
unlimited
smartapp_hvac

(www.rboyapps.com - Make your home your butler!) #1

Creating a new thread to avoid confusion, a buggy version of this thermostat was posted under the CT-100 thermostat. I've cleaned it up, fixed the bugs and reposting here.

If you like the App consider supporting our development efforts. Visit our Facebook page to updates on new apps and to get Access to all our Premium Apps Server. http://www.facebook.com/RBoySTApps

The latest version of these apps with udpates are available on the RBoy server at

. Refer to our Facebook page to get access to the server.

This one allows one to create unlimited individual thermostat programs, for each program you will need to install the app once. You can create unlimited numbers of instances, each time it changes the thermostat(s) once (heat and cool). It doesn't change the mode, just sets the heat and cool points.

/* **DISCLAIMER**
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Without limitation of the foregoing, Contributors/Regents expressly does not warrant that:
* 1. the software will meet your requirements or expectations;
* 2. the software or the software content will be free of bugs, errors, viruses or other defects;
* 3. any results, output, or data provided through or generated by the software will be accurate, up-to-date, complete or reliable;
* 4. the software will be compatible with third party software;
* 5. any errors in the software will be corrected.
* The user assumes all responsibility for selecting the software and for the results obtained from the use of the software. The user shall bear the entire risk as to the quality and the performance of the software.
*/ 

/**
*  Individual Change Thermostat
*  Allows you to set single/multiple thermostats to different temp during different days of the week unlimited number of times (one app instance for each change)
*
*  Base Code from : Samer Theodossy, bugfixed and enhanced by RBoy
*  Changes Copyright RBoy, redistribution of any changes or modified code is not allowed without permission
*  Version 1.0.4
*  2016-5-15 - Notify use if timezone/location is missing in setup
*  2015-11-21 - Fixed issue with timezone, now takes timezone from hub
*  2015-6-17 - Fix for changes in ST Platform
*  Update - 2014-11-25
*/

// Automatically generated. Make future change here.
definition(
    name: "Individual Change Thermostat",
    namespace: "rboy",
    author: "RBoy",
    description: "Setup unlimited adjustments to the thermostat(s), install this app once for each change you want to make",
    category: "Green Living",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/GreenLiving/Cat-GreenLiving.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/GreenLiving/Cat-GreenLiving@2x.png",
    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/GreenLiving/Cat-GreenLiving@3x.png"
)

preferences {
    section("Set these thermostats") {
        input "thermostat", "capability.thermostat", title: "Which?", multiple:true
    }

    section("To these temperatures") {
        input "heatingSetpoint", "decimal", title: "When Heating"
        input "coolingSetpoint", "decimal", title: "When Cooling"
    }

    section("Configuration") {
        input "dayOfWeek", "enum",
            title: "Which day of the week?",
            required: true,
            multiple: true,
            options: [
                'All Week',
                'Monday to Friday',
                'Saturday & Sunday',
                'Monday',
                'Tuesday',
                'Wednesday',
                'Thursday',
                'Friday',
                'Saturday',
                'Sunday'
            ],
            defaultValue: 'All Week'
        input "time", "time", title: "At this time"
    }

    section( "Notifications" ) {
        input "sendPushMessage", "enum", title: "Send a push notification?", options:["Yes", "No"], required: false
        input "phoneNumber", "phone", title: "Send a text message?", required: false
    }
}

def installed() {
    // subscribe to these events
    log.debug "Installed called with $settings"
    initialize()
}

def updated() {
    // we have had an update
    // remove everything and reinstall
    log.debug "Updated called with $settings"
    initialize()
}

def initialize() {
    unschedule() // bug in ST platform, doesn't clear on running
    TimeZone timeZone = location.timeZone
    if (!timeZone) {
        timeZone = TimeZone.getDefault()
        log.error "Hub timeZone not set, using ${timeZone.getDisplayName()} timezone. Please set Hub location and timezone for the codes to work accurately"
        sendPush "Hub timeZone not set, using ${timeZone.getDisplayName()} timezone. Please set Hub location and timezone for the codes to work accurately"
    }

    def scheduleTime = timeToday(time, timeZone)
    def timeNow = now() + (2*1000) // ST platform has resolution of 1 minutes, so be safe and check for 2 minutes) 
    log.debug "Current time is ${(new Date(timeNow)).format("EEE MMM dd yyyy HH:mm z", timeZone)}, scheduled time is ${scheduleTime.format("EEE MMM dd yyyy HH:mm z", timeZone)}"
    if (scheduleTime.time < timeNow) { // If we have passed current time we're scheduled for next day
        log.debug "Current scheduling check time $scheduleTime has passed, scheduling check for tomorrow"
        scheduleTime = scheduleTime + 1 // Next day schedule
    }
    log.debug "Scheduling Temp change for " + scheduleTime.format("EEE MMM dd yyyy HH:mm z", timeZone)
    schedule(scheduleTime, setTheTemp)
}

def setTheTemp() {
    def doChange = false
    Calendar localCalendar = Calendar.getInstance()
    localCalendar.setTimeZone(location.timeZone)
    int currentDayOfWeek = localCalendar.get(Calendar.DAY_OF_WEEK)

    // Check the condition under which we want this to run now
    // This set allows the most flexibility.
    if(dayOfWeek.contains('All Week')) {
        doChange = true
    }
    else if((dayOfWeek.contains('Monday') || dayOfWeek.contains('Monday to Friday')) && currentDayOfWeek == Calendar.instance.MONDAY) {
        doChange = true
    }

    else if((dayOfWeek.contains('Tuesday') || dayOfWeek.contains('Monday to Friday')) && currentDayOfWeek == Calendar.instance.TUESDAY) {
        doChange = true
    }

    else if((dayOfWeek.contains('Wednesday') || dayOfWeek.contains('Monday to Friday')) && currentDayOfWeek == Calendar.instance.WEDNESDAY) {
        doChange = true
    }

    else if((dayOfWeek.contains('Thursday') || dayOfWeek.contains('Monday to Friday')) && currentDayOfWeek == Calendar.instance.THURSDAY) {
        doChange = true
    }

    else if((dayOfWeek.contains('Friday') || dayOfWeek.contains('Monday to Friday')) && currentDayOfWeek == Calendar.instance.FRIDAY) {
        doChange = true
    }

    else if((dayOfWeek.contains('Saturday') || dayOfWeek.contains('Saturday & Sunday')) && currentDayOfWeek == Calendar.instance.SATURDAY) {
        doChange = true
    }

    else if((dayOfWeek.contains('Sunday') || dayOfWeek.contains('Saturday & Sunday')) && currentDayOfWeek == Calendar.instance.SUNDAY) {
        doChange = true
    }

    // some debugging in order to make sure things are working correclty
    log.debug "Calendar DOW: " + currentDayOfWeek
    log.debug "Configured DOW(s): " + dayOfWeek

    // If we have hit the condition to schedule this then lets do it
    if(doChange == true){
        log.debug "setTheTemp, location.mode = $location.mode, newMode = $newMode, location.modes = $location.modes"
        thermostat.setHeatingSetpoint(heatingSetpoint)
        thermostat.setCoolingSetpoint(coolingSetpoint)
        send "$thermostat heat set to '${heatingSetpoint}' and cool to '${coolingSetpoint}'"
    }
    else {
        log.debug "Temp change not scheduled for today."
    }

    log.debug "Scheduling next check"

    initialize() // Setup the next check schedule
}

private send(msg) {
    if (sendPushMessage == "Yes") {
        log.debug "sending push message"
        sendPush(msg)
    }

    if (phoneNumber) {
        log.debug "sending text message"
        sendSms(phoneNumber, msg)
    }

    log.debug msg
}

[RELEASE] 5-2 Day Programmable Thermostat Scheduler (Weekday, Weekend) with Remote Temperature Sensor for each Schedule
CT-100 Schedule
Thermostat SmartApps that uses Virtual Switches to control Mode/Fan/SetPoints
Scheduler for ct100
Migrating from SmartThings to Vera Plus
Honeywell TH8320ZW thermostat communication problem
[RELEASE] 5-2 Day Programmable Thermostat Scheduler (Weekday, Weekend) with Remote Temperature Sensor for each Schedule
Thermostat SmartApps that uses Virtual Switches to control Mode/Fan/SetPoints
Feedback On This Forum
New to SmartThings looking for help: Thermostat plus multiple sensors?
#2

@RBoy I've been trying to use a version of this to also include the ability to set the fan mode to auto, on, or circulate, but I 'm not a coder and I'm having a little trouble. Would you mind please referencing the thread below and tell me if you see something obvious?


(www.rboyapps.com - Make your home your butler!) #3

Try this:

section("To this Fan setting") {
	input "fanSetpoint", "enum", title: "Which setting?", multiple:false, 
    metadata:[values:["fanOn","fanAuto","fanCirculate"]]
}

The change I made is double quotes.


#4

RB, Thanks to you and other who helped!


(www.rboyapps.com - Make your home your butler!) #5

Added option to select multiple days of the week now


#6

Hi guys just new in Smartthings and bought a CT100 thermostat in addition of from my smartthings kit. I install your Ultimate Customizable tstat smartapps but heating still use the setting in the Thermostat itself and not with this smartapps. I can change mode(heat/cool/auto/off), fan(auto/on), temp adjustment from smartphone app And have no clue about it. Even use the Make me Cozzy II prior. Still the same thngs happen. Need some help regarding with this maybe theres a problem like this before but i just don't find in the forum. Thanks.


(www.rboyapps.com - Make your home your butler!) #7

but heating still use the setting in the Thermostat itself and not with this smartapps

Explain some more what you mean by that. You're setting a temperature through the smart app but the set temperature on the physical thermostat does not match what you're setting in the app?
What about if you change the temp from the device on the ST type app - does that reflect on the physical thermostat?


#8

I mean the furnace still runs according to the setpoint of the thermostat (ct100). It doesn't response according to the smartapps setting. Heating setpoint in CT100 was 70 and I try to put heating set point in the smartapps at 72. And the furnace still will stop at 70 not at 72. Yes when I change temp setpoint in STapp it reflects to the physical thermostat


#9

Like I scheduled for all week at 11am putting heating setpoint at 72 on the Individual thermostat smartapps. So at that time setpoint on heating should also change to 72 instead of the previous setpoint of 70 but it doesn't.


(www.rboyapps.com - Make your home your butler!) #10

So what you're saying is that when you change the temp in the STApp through the device user interface (under things) the change shows up in the thermostat (say 72) but the thermostat still cuts off at 70.

If that's the case then you likely have a defective thermostat or your thermostat swing is set too high. To change the swing, click on Menu on the physical thermostat, there will be a on the top center will the swing number, click to change it and reduce it to 0.5 or 1.0


#11

Swing is at 1 already. I don't know if I explain it properly to you. Physical thermostat right now setting is at 70 heating and 75 cooling. Now I configure the Ultimate Customizable thermostat (Also called Individual Change Thermostat) in Four instances the same "all week" but the time is at 7am, 11am, 6pm, 9pm with 70deg, 72deg, 69deg, 67deg. on heating setpoint respectively. With 75deg cooling for all 4 instances. So is the physical thermostat setpoint will change to 72 deg at 11pm, 69 deg at 6pm, 67deg at 9pm automatically or not? Because when I look at the activity on thermostat in STapp thing it still cuts off (heating stops) at 70 deg. Means heating did not respond to the 4 instances setting I mean 3 because one instances is already 70deg.


(www.rboyapps.com - Make your home your butler!) #12

Okay I understand what you're saying but I'm trying to isolate whether the issue is with the app/thermostat communication or thermostat issue internally.

So when you look at the thermostat, it will have 2 numbers, in center (BIG and bold current temp), and the target temp at the bottom left corner.

At 11am it should change the target temp to 72deg (according to your post). Can you verify what target temp shows at 11:01am and 11:05am (sometimes the timer may fire slightly later)?


#13

It was still 70deg. But by the way I think problem was solved. On that evening I notice that there is update for smartthings app Updated it. At 9pm in front of the physical thermostat am watching the setpoint change from 70deg to 68 deg. I' m glad that it works already. Maybe theres a problem in smartthings app in android that the smartapps doesn't communicate to the STapp thing. And thank Rboy for sharing thoughts trying to resolve my problem.


#14

One question Rboy could i use two smartapps for the thermostat? Because I want a setting for away. The ultimate customize thermostat there's an option for the mode so I will just exclude the away on that option. Is there any smartapps that trigger the thermostat base on mode? Anyway i will just search in the forum.


(www.rboyapps.com - Make your home your butler!) #15

Yes that's a pretty common way to use it. When you setup the app options scroll down to the last option which says Only during Mode and select everything except Away. Then you can use another app (or your can edit your mode and select change thermostat temp) for away mode similarly.


#16

Thanks I got it.I can still use the same smartapps. Oh one more thing do i still need to set the time or leave it blank so it will trigger anytime as long its on away mode.


(www.rboyapps.com - Make your home your butler!) #17

Not sure what you meant by this. The way ST works is that apps are never constantly running, they are run at events or schedules. So if the app is configured to work while in away mode, then the schedules/event will make the app execute it's functions. If it isn't configured to work in away mode then those functions will never be called even if the schedules/events are hit while in away mode.

So say if you've set the app NOT to operate in Away mode and you configure it to change the temp at 8:00pm. Say at 8:00pm the hub in away mode, this app will NOT be called so the temp won't change. Say at 8:15pm you change the mode back to Home, since the schedule has passed it will NOT call the app. This is by design since this Ultimate App is designed to set the temp at a particular time it cannot guess when the next temp change is set (another instance of the app), it could be 1 minute or 1 hour or never, so the app doesn't second guess the user's intention here.

However if you use the 5-2 Thermostat I've published below, that DOES know that there are only X number of schedules set by the user in a day, so if the app returns from Away mode back to Home mode (e.g. as before it's configured not to work in away mode), the app will determine that the last trigger didn't fire and will set the temp to the appropriate temp within the current scheduled time. So say for e.g. you set the return temp to 70 and time to 7:30pm and the sleep temp to 65 and time to 11:00pm, as in the above case since you're in away mode at 7:30pm it won't change the temp, but when you change back to Home mode at 8:15pm, it will detect that the schedule didn't fire and the next temp change is scheduled for 11:00pm, it will change the temp to 70 at 8:15pm (which it the temp set between 7:30pm and 11:00pm). Hope this helps.


(www.rboyapps.com - Make your home your butler!) #18

On user request, created a new app to turn the Fan on/off on a Schedule:


(www.rboyapps.com - Make your home your butler!) #19

Fix for changes in ST platform


(Jason) #20

Hello-

I was just looking at this and wondered what thermostat's this was compatible with? I have a Nest and have yet to find a good SmartApp/DeviceType combo that takes advantage of many of the features of my Nest. I didn't see Nest anywhere in this thread and the picture seem to indicate it was for some other z-wave type of thermostat.

Thanks!
-Jason