Two CS-50 Thermostats [solution]

Started by DrEmil, May 26, 2016, 09:18:47 PM

DrEmil

Big house with two separate HVAC systems. How to add a second CS-50 to the PI Gateway? Tried just adding a second false node and and additional IP address in settings but didn't seem to work. I'm sure it is something simple. Thoughts?

Felix

Hmm, why didnt i think of this.
The problem is that at the bottom of metrics.js there are 2 functions which always point to the same ip that is in settings.

exports.tstatPoll
exports.tstatRequest

So even if you add another setting, it is not used.

To make this work ... you'd need to either duplicate the entire set of event functions (including these 2 above) to make them point to your new setting. Or the setting to become a node setting, which is not supported at the moment, but it's on my feature list. Having node settings would be very useful in cases like this. Then the function would be generic, but it would point to a node setting which can vary from node to node. To support something like that, major changes are needed. I think your best bet is the first variant I mentioned.

DrEmil

Thanks for the quick response. I've been busy at work but will work your solution tonight. Great product support and forum.
Best,
Eric

Felix

If you end up duplicating the TSTAT functions, you will also need new events that call those functions. Just search for where the functions are used and then duplicate those events also (+ assign new names for events), I would just prepend everything with a "2" or whatever to distinguish. Although it's a duct tape solution I think this should work until i come up with a better solution.

DrEmil

Works great just adding a 2 to everything thermostat related in both metrics.js and in settings.json (for the 2nd IP)

In metrics.js, the functions exports.tstatRequest2 and exports.tstatPoll2 call the thermostat API via URL/HTTP. In those two places be sure to leave the last part fo the URL '/tstat';   and NOT '/tstat2';. Since this is an API function, it is independent of other moteino-based definitions.

Many thanks!

Felix

Awesome, glad to hear this worked!