ivesdebruycker / node-red-contrib-maxcube

A node-red node to control the eQ-3 Max! Cube
Other
13 stars 12 forks source link

Feature: Setting mode #7

Open tedstriker opened 7 years ago

tedstriker commented 7 years ago

Hi there, would it be possible to add the property to set the thermostat mode as well?

cheers, Ted

ivesdebruycker commented 7 years ago

Do you mean Auto/Manual/Vacation/Boost? That seems doable. Message could then look like this:

{
  "rf_address": "0abc12",
  "degrees": 20,
  "mode": "MANUAL"
}

and

{
  "rf_address": "0abc12",
  "mode": "AUTO"
}
tedstriker commented 7 years ago

Yes, that's what I meant. It would be great if the mode were controllable, too.

ivesdebruycker commented 7 years ago

Feature added in 40969fb. Could you test this? Boost works for me:

{
    "rf_address": "0abc12",
    "mode": "BOOST"
}

MANUAL is assumed when no mode present. Haven't tried VACATION.

tedstriker commented 7 years ago

Finally found some time to test it. BOOST and MANUAL are working fine. Trying to set mode to AUTO returns an TypeError: Invalid hex string error, which is bad. AUTO is quite important to return back to the preprogrammed heating schedule after using MANUAL.

VACATION returns an error as well. ReferenceError: moment is not defined - Probably due to missing untilDate Parameter. Even if provided in payload as {"rf_address":"012345", "mode":"VACATION", "untilDate":"05.12.2016 14:00"} it does return the same error. In my opinion VACATION is not that important, as we're already able to switch between AUTO & MANUAL and can maintain custom temperature set points easily that way.

jwildeboer commented 7 years ago

AFAICS this feature isn't yet available in the npm released version, correct? I am using 0.0.4. And I concur. Being able to set one or all thermostats back to AUTO is really important for my usecase too.

My plan: When I leave the house, I want to set all thermostats to 12°C. And some time before I return, I want to switch them all back to AUTO, so whatever weekly program has been set gets active again.

Sort of like remotely pressing the ECO switch that I actually have but all too often forget to press when I leave ...

So I hope we will soon be able to do just that ;-)

tedstriker commented 7 years ago

@jwildeboer you're right. It's not available in npmjs yet. I guess it's because the current feature was untested. Good thing, because we found a bug. As I'm a quite busy in the days to come, maybe you got time on your hands and speed up the process by providing a pull request? Don't know which priority it has for @ivesdebruycker.

jwildeboer commented 7 years ago

@tedstriker I will dedicate some time over the weekend to test and maybe fix the issues. But that means I first need to understand how I can install the github MASTER on my node.js. Being the ignorant user, I know how to install a nnpmjs package, but not how to do it manually straight from source ;-)

I will also try to get working support for the shutter contacts so that it delivers the expected CLOSED or OPEN.

And maybe fiddle a bit with teh code to add the room and name info in to the payload. No promises given, but I'll try.

ivesdebruycker commented 7 years ago

Setting mode to AUTO and VACATION now is working with latest release of maxcube (1.0.4). Performing an update (npm update maxcube) in node-red-contrib-maxcube folder should suffice.

@jwildeboer git clone https://github.com/ivesdebruycker/node-red-contrib-maxcube.git node-red-contrib-maxcube

jwildeboer commented 7 years ago

But in order to test that I also need to upgrade nodered-contrib-maxcube to MASTER, correct? Because the 0.0.4 I have via npmjs doesn't have the changes from 40969fb Or is it enough to manually edit the maxcube.js file and restart nodered for testing? (Yes, I am total n00b wrt node, npm, github workflow ;-)

ivesdebruycker commented 7 years ago

@jwildeboer

  1. Quit node-red
  2. Remove current nodered-contrib-maxcube folder
  3. Download latest version: git clone https://github.com/ivesdebruycker/node-red-contrib-maxcube.git node-red-contrib-maxcube
  4. Install dependencies (i.e. latest maxcube): cd node-red-contrib-maxcube; npm install
  5. Start node-red

From now on you can always update to latest version (master): git pull origin master

jwildeboer commented 7 years ago

Thank You! Just made all teh changes and am starting to test now!

jwildeboer commented 7 years ago

After starting nodered I now get

Dec 07 16:26:22 rpi.home.lan nodered[2587]: 7 Dec 16:26:22 - [info] [maxcube out:33dbadd9.bb96b2] {"duty_cycle":0,"free_memory_slots":0} Dec 07 16:26:22 rpi.home.lan nodered[2587]: 7 Dec 16:26:22 - [error] [maxcube out:33dbadd9.bb96b2] Error: Maxcube not initialised

But when I send sth to the maxcube out node, I get all the status info, so I guess this is a cosmetic problem?

Anyway. When I send a messaqe to a maxcube in node, it gets succesfully injected according to nodered but it somehow doesn't seem to get send/accepted by the cube as the status doesn't update :-(

I get

07 16:30:09 rpi.home.lan nodered[2587]: 7 Dec 16:30:09 - [info] [maxcube in:26cc5c00.ffb884] Error setting temperature

I inject a JSON in nodered with

{"rf_address":"0ca84e","degrees": 15 }

as content. I guess I am missing something? The node info says it expects an object, not sure I am sending it the right thing.

jwildeboer commented 7 years ago

Ah, it dawns on me what the problem is. I guess this should be filed as a new issue against maxcube?

I use the wall thermostat displays (EQ3MAX_DEV_TYPE_WALLTHERMOSTAT = 3) in my bedroom and in my livingroom. And when a heater thermostat (EQ3MAX_DEV_TYPE_THERMOSTAT = 1) is coupled with a wall display, it seemingly doesn't accept direct commands. IIRC in that setup you send a temperature command to the room_id, which AFAICS is not possible in maxcube.

The wall thermostat also cannot be used to set the temperature or mode, it results in

Dec 07 16:43:45 rpi.home.lan nodered[2587]: 7 Dec 16:43:45 - [info] [maxcube in:4116adfa.b3ac54] Error setting temperature

But the thermostats in my bathroom and in the kitchen, who are NOT linked to a wall display work as expected. Temperature change works. Changing mode works.

I guess we need a different way to set the temperature/mode in the case of a room controlled via a wall display.

Raised as issue against maxcube at https://github.com/ivesdebruycker/maxcube/issues/14

IMHO when scope is "manage thermostats directly" this issue can be considered closed. If the scope is "mode setting should Just Work(tm)" it isn't ;-)

tedstriker commented 7 years ago

gave it a shot and it's working quite good and reliable. Just one thing: sending this payload {"rf_address":"012345", "degrees":19.5} while in AUTO mode changes not only the set point but also the mode. Sending payload = {"rf_address":"012345", "mode":"AUTO", "degrees":19.5} while being in mode MANUAL, just changes the mode to AUTO with its current default temperature. I don't know if you intended to make it behave like that, but maybe it's worth a reconsideration to limit changes only to submitted properties. Maybe it's a behavior of the maxcube itself. I can't tell right now. Anyways, it's something one can deal with.

Besides that quirk, I think you @ivesdebruycker, can make a bunch of people very happy, pushing out version 0.0.5 to npmjs. Thanks for your effort; it made moving away from openhab much easier.

jwildeboer commented 7 years ago

@tedstriker Uhm. Yes. All of that is expected and correct behaviour.

When in AUTO mode, the week program that has been defined and stored in the thermostat is active. The week program defines temperature and times.

So when you change the temperature of a thermostat that is in Auto mode, it switches to MANUAL as your temperature change means it is now using settings that are not part of the week program.

So it's either AUTO which means you do not get to set temperature as it already is in the defined week program or it is MANUAL when you set your own temperature which is different from the week program.

ivesdebruycker commented 7 years ago

Actually, it seems you can set the temp in AUTO mode. Probably a temporary override until the next programmed period. Fixing it now.

It would probably be better to always explicitly define the mode, and not assume it's MANUAL when not set.

ivesdebruycker commented 7 years ago

Fixed in maxcube 1.0.5 (so npm update maxcube).

FYI, v0.0.5 will have 2 breaking changes:

tonivss commented 5 years ago

Hi, I've used version 0.0.4. Since I wanted to be able to set the mode I tried using the steps above. I started node red again and I am getting error: TypeError: must start with number, buffer, array or string

node red starts and breaks over and over again. I tried deleting it and use ver. 0.0.4 again but that did not fix the problem. Any idea?

Cheers, Malte

tedstriker commented 5 years ago

what version of nodejs and what version of node red are you using? Also: you are asking for support for version 0.0.4? Did you try the most recent version 0.0.5 instead?

updated: wrong version. also: @ivesdebruycker can you push your changes to npm?

tonivss commented 5 years ago

I set up the Pi once again. Now it's all up to date. maxcube and node red are working fine now. Now I need to figure out how to set the temperature in AUTO mode and the thermostat will change the temperature by beginning a new time period. Thank you anyway... An to you @ivesdebruycker: great work! I'm happy to be able to control my heater with my phone/pc.