[userMODULE] ClimateControl (Updated Dec 17, 2014)

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
Post Reply
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

[userMODULE] ClimateControl (Updated Dec 17, 2014)

Post by islipfd19 »

Ok, so this one was fun to put together; especially since I wrote most of it from scratch and only referred to other modules for references.

This module allows you to set your thermostat mode to heat, cool, auto or off modes depending on the time of year and based on the current temperature outside. I don't use auto mode on my thermostat because some parts of the year either though it may be cold outside I can deal without the heat in the house, thus saving more energy and $$$.

When configuring this module, it will ask you for the City and Country you live in. This will allow the module to retrieve the current temperature outside just like the OpenWeather module does. It also asks which units the measurement should be in, either Celsius or Fahrenheit. The mode to set the thermostat to and the month to change the mode.

Currently, you will have to enter the actual device node Id of your thermostat because I'm unable to list it as a device like all the other modules do with the switches, dimmers and sensors. This field requires to be an integer, for example; my thermostat id is 2, so I would enter the number "2" in this field (which is already present as a placeholder and as an example). You can look up your node Id of your thermostat in the Expert UI screen.

I also list your desired Target Temp, this is used to calculate whether to set your thermostat mode at your selected month. For instance, if you select the heat mode and the temperature outside falls below your desired temperature and you've entered and you've selected October as your month your thermostat will be set to heat mode. The opposite holds true to "Cool" mode. If you select "Off" or "Auto", the thermostat will just be set to those modes. The 'Target Temp' is optional so you don't have to enter any values and will only appear once one of the modes is selected.

Known Bugs / Issues:
***None known ***

Misc:
More testing and different scenarios still need to be performed. Basic functionality works.

To-Do:
1. Enhancement such as setting the temp on the thermostat.
2. Add an array type structure in the json file so that one can add multiple instances in the module instead of adding multiple modules. (COMPLETE - now in version 1.0.1 and renamed from ThermostatRules to ClimateControl)
Attachments
ClimateControl_z-way_2.0.0.zip
(3.19 KiB) Downloaded 425 times
ClimateControl.1.0.1.zip
(2.85 KiB) Downloaded 445 times
Last edited by islipfd19 on 17 Dec 2014 16:25, edited 3 times in total.
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: New Module ThermostatRules

Post by islipfd19 »

Ok guys, I need some help with this. I'm working on the next version of this module so I can scratch off one of the To-Do's that I've listed. I've been able to get the module.json file setup correctly, it lists the City, Country and Units at the top level and then there's an array for month, target temperature and mode selection. The goal is to only have to setup one rule for this module for different times of the year. The current version doesn't allow this and you need to setup multiple rules. I'm also renaming this module to ClimateControl, I think the new name is better suited.

So here's my problem, when I set the values in the array for the month, mode and target temp; the variables are listed as undefined (null for mode, there is some logic behind that). I don't know how to get these values to display :?: I've looked at several of the preexisting modules, I'm pretty sure I have the path to the value that's associated with the json file as it doesn't give me errors in the log file.

The way I've been debugging my modules is by adding console.log lines at key points of the script. I open a two terminal window and run `tail -f /var/log/z-way-server.log` and `tail -f /var/log/z-way-server.log | grep ClimateControl`, I grep for ClimateControl since this is in every console.log entry. It helps locate what I need and if there are any additional errors I look at the full log. Any help would be greatly appreciated.

Just to add, I'm very new to javascript but have am very familiar in bash and somewhat familiar in perl scripting so figuring out javascript hasn't been all that difficult, needless to say google has been my friend as well. I just can't seem to get past this sticking point.
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: New Module ThermostatRules

Post by islipfd19 »

OK, so I was able to figure out what I needed to do so that one can add multiple schedules to one rule. I've provided a new version of this module and renamed it to ClimateControl. Before deleting the directory in your userModules folder (or if you are running version 1.7.1 or earlier version, the module is most likely in your modules directory with the standard ones) be sure to remove all rules in the automation screen for ThermostatRules. Otherwise you will get errors in the notification area.
t2tonesimone
Posts: 22
Joined: 31 Dec 2012 22:43

Re: New Module ClimateControl (Updated Aug 12, 2014)

Post by t2tonesimone »

Any chance of a simple instructions for installing it
I'm abit of a noob
Thanks
Simon
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: New Module ClimateControl (Updated Aug 12, 2014)

Post by islipfd19 »

Depends on the version you are running. If you are running 1.7.1, extract the zip contents to a folder called ClimateControl to the modules directory. If you are running 1.7.2, extract the contents to a folder called userModules. These directories reside in the zway installation path. After doing that, restart the zway service. The module should not list in the automation dropdown menu.
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: [userMODULE] ClimateControl (Updated Aug 12, 2014)

Post by islipfd19 »

Unknown if there is a compatibility issue with version 2.0. Though it may not be necessary as the new releases will have climate control built in.
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: [userMODULE] ClimateControl (Updated Aug 12, 2014)

Post by islipfd19 »

I added a zip to the first post for the z-way 2.0.0 version.
Post Reply