Giter Site home page Giter Site logo

nefit-easy-commands's Introduction

Nefit Easy™ commands

High-level command implementation for Nefit Easy™.

Please be considerate!

Use this library in moderation: don't flood the backend with new connections made every X seconds. Instead, if you want to poll the backend for data, create a connection once and reuse it for each command. In the end, it's your own responsibility to not get blocked because of excessive (ab)use.

Installation

$ npm i nefit-easy-commands

API

Constructor

const NefitEasyCommands = require('nefit-easy-commands');
const client            = NefitEasyCommands({
  serialNumber   : NEFIT_SERIAL_NUMBER,
  accessKey      : NEFIT_ACCESS_KEY,
  password       : NEFIT_PASSWORD,
[ requestTimeout : Number ]
});

Current status

client.status([skipOutdoorTemperature]) : Promise

If skipOutdoorTemperature is true, the client won't make an extra request to retrieve the current outdoor temperature.

Current pressure

client.pressure() : Promise

Hot water supply state

client.hotWaterSupply() : Promise

Known location for device

client.location() : Promise

Program data

client.program() : Promise

User mode

client.userMode() : Promise

Set hot water supply state

client.setHotWaterSupply(value : String) : Promise

value should be one of on/off.

Set user mode

client.setUserMode(value : String) : Promise

value should be one of manual/clock.

Set temperature

client.setTemperature(value : [Number|String]) : Promise

value can be prefixed with a specifier to add a bit of logic to changing the setpoint.

The specifier can contain a base for relative changes:

  • setpoint : this is the current target temperature;
  • in house temp : this is the current measured temperature;

Valid specifiers:

  • > VALUE : only change setpoint to "VALUE" if it's larger than the current setpoint;
  • < VALUE : only change setpoint to "VALUE" if it's smaller than the current setpoint;
  • setpoint + VALUE : increase the setpoint by "VALUE"
  • setpoint - VALUE : decrease the setpoint by "VALUE"
  • in house temp + VALUE : change the setpoint to in house temperature + "VALUE"
  • in house temp - VALUE : change the setpoint to in house temperature - "VALUE"

Examples:

  • "Set the thermostat to 21°C, but only if it's not already set higher than that."
client.setTemperature('> 21').then(...)
  • "Increase the setpoint by 2.5°C"
client.setTemperature('setpoint + 2.5').then(...)
  • "Set the setpoint to the current in house temperature and add 2.5°C"
client.setTemperature('in house temp + 2.5').then(...)

nefit-easy-commands's People

Contributors

mvgalen avatar raimondb avatar robertklep avatar twistedfall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nefit-easy-commands's Issues

How to reset CV

Hi,

My NEFIT Central Heating system (CV) crashes with an error message now and then (“burner doen’t ignite”), so I need to reset the CV once every month manually. I do this via the rest button on the outside of the CV system itself.
I could not find an option in your software to send a reset command via the interface. I can still send other commands to the CV via your software..

Is there a way to reset the CV using your software and if not, could this be implemented?

Rgds,
Bart

Handle invalid pressures

Pressure can be "25.5" or serialnr to reflect that the actual value is unknown; .pressure() command should yield null in that case.

Increase current temperature

I would like to be able to set the temperature x degrees higher than the current temperature, as a way to make sure the CV will start heating in order to manage zonebased heating scenario's for other rooms.

I could build it in to the node-red-nefit-easy2, but the better place would be this library I think.
What do you think?

I'm thinking that instead of '> 20' and '< 20' one could also have a specifier of '+2.0' or ' -2.0' as an argument to the setTemperature command

Example does not work under NodeJs 12

I'm using your library successfully since a long time in an ioBroker home automation environment. So far I was using NodeJs 10 and have now a parallel installation with NodeJs 12.
When I now execute status.js in the new NodeJs 12 based setup, the function simply does not return.
I use node status.js.

I don't know if the NodeJs version is the reason but I don't know any other major difference.
Any chance to debug the situation?
Thanks
Christof

Gasusage API

I'd like to use the GasUage commands to get the gas usage for today or maybe yesterday,
Can you point me in the right direction how to use the commands.
I'm getting a bit confused with the paging stuff.

Thanks in advance!

Function of client.setHotWaterSupply

Hi, I'd like to get some clarity on the exact use of the client.setHotWaterSupply function. Is this used to fully disable/block hot water supply from the heater (regardless the setpoints on the thermostat)? I'm working on an automation project in which my gas heater and solar heating work together. There are some states where I'd like to block the hot water supply from the gas heater.
Thanks for the great project!

"Catch" doesn't catch all exceptions

I'm using your library successfully, really thanks for the work.
I use it in an ioBroker (homeautomation server) environment which is JavaScript based.

My problem is, that from time to time I get an uncaugt exception which crashes the JavaScript engine in ioBroker.
I based my code on your example:

function ReadValues()
{
// Instantiate client
const client = NefitEasyClient({
serialNumber : "xx",
accessKey : "yy",
password : "zz",
});
// Connect client and retrieve status and pressure.
client.connect().then( () =>
{
return Promise.all([ client.status(), client.pressure() ]);
}).then(response =>
{
const status = response[0];
console.log(JSON.stringify(status));
const pressure = response[1];
console.log("Temperature is set to " + status['temp setpoint'].toFixed(1) + " °C, current is " + status['in house temp'].toFixed(1) + " °C.\n" +
"Outside temperature is "+status['outdoor temp'].toFixed(1)+" °C.\n" +
"User Mode is "+status['user mode']+".\n" +
"System pressure is " + pressure.pressure + " " + pressure.unit);
}).catch((e) =>
{
console.error(e);
}).finally(() =>
{
client.end();
});
}

My output:

2020-01-02 09:12:01.314 - info: javascript.0 (28942) script.js.common.Nefit: {"user mode":"clock","clock program":"auto","in house status":"ok","in house temp":19.6,"hot water active":true,"boiler indicator":"central heating","control":"room","temp override duration":0,"current switchpoint":24,"ps active":false,"powersave mode":false,"fp active":false,"fireplace mode":false,"temp override":false,"holiday mode":false,"boiler block":null,"boiler lock":null,"boiler maintenance":null,"temp setpoint":21,"temp override temp setpoint":17,"temp manual setpoint":21,"hed enabled":null,"hed device at home":null,"outdoor temp":3,"outdoor source type":"virtual"}
2020-01-02 09:12:01.314 - info: javascript.0 (28942) script.js.common.Nefit: Temperature is set to 21.0 °C, current is 19.6 °C.
Outside temperature is 3.0 °C.
User Mode is clock.
System pressure is 1.8 bar
2020-01-02 09:12:01.342 - error: javascript.0 (28942) uncaught exception: read ECONNRESET
2020-01-02 09:12:01.343 - error: javascript.0 (28942) Error: read ECONNRESET
2020-01-02 09:12:01.963 - error: host.ioBroker Caught by controller[0]: { Error: read ECONNRESET
--
2020-01-02 09:12:01.964 - error: host.ioBroker Caught by controller[0]: at TLSWrap.onread (net.js:622:25)
2020-01-02 09:12:01.964 - error: host.ioBroker Caught by controller[0]: errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }

So although the readout was successful, the exception ECONNRESET is thrown and unfortunately not caught be the "catch" statement.

Any hint?
Thanks
Christof

Security bug in one of your dependencies.

Hi,

I am using your package and it contains a security bug inside one of its dependencies.
It was detected by Snyk, which I am runing om my packages. See the report below.

Vulnerable module: minimist
Introduced through: [email protected]
Exploit maturity: Proof of concept
Fixed in: 0.2.1, 1.2.3
Detailed paths
Introduced through: [email protected][email protected][email protected][email protected][email protected]
Remediation: Your dependencies are out of date, otherwise you would be using a newer minimist than [email protected]. Try relocking your lockfile or deleting node_modules, reinstalling and running snyk wizard. If the problem persists, one of your dependencies may be bundling outdated modules.
Overview
minimist is a parse argument options module.

Affected versions of this package are vulnerable to Prototype Pollution. The library could be tricked into adding or modifying properties of Object.prototype using a constructor or proto payload.

display-code decoding

When CV are normal operated system/appliance/causecode will be always "0" [ need confirmation from EMS type users: Proline/Trendline/Smartline]
as well for old iRT based boilers (like EcomLine and Excelent) cause code not used at all even for error handling.
So decoding for normal procedure data (to be determine by service manual [geen actie nodig], eg: -H; =H; 0U; 0Y; ) should be based only by display code

Douchetimer

Dear Robert,

Thanks for the home bridge Nefit app.

Is it possible to add the shower timer (“douchetimer”) to the commands?
It is an option to stop the hot water supply after x minutes.
Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.