npm package: @lauradebaets/home-automation
Description: ![npm badge](https://img.shields.io/badge/npm-v1.0.0-blue.svg)
Author: lauradebaets
Latest version: 0.8.1


# Home automation

![npm badge](https://img.shields.io/badge/npm-v0.8.1-blue.svg)

![ESLint](https://github.com/vives-software-engineering-2020/home-automation-debaetslaura/workflows/ESLint/badge.svg?branch=master)

![Markdown Linter](https://github.com/vives-software-engineering-2020/home-automation-debaetslaura/workflows/Markdown%20Linter/badge.svg?branch=master)

![Tests](https://github.com/vives-software-engineering-2020/home-automation-debaetslaura/workflows/Tests/badge.svg?branch=master)

> You can set the thermostat to the desired value, with a range and the unit.
> Then you can provide an update of the temperature, also with the unit.
> Everything is displayed in json.

![example](/img/example1.png)

## Installation

you must have typescript!!! otherwise ->

```sh
npm install -g typescript
```

Installing the home-automation for windows:

```sh
npm install @lauradebaets/home-automation
```

## Using examples

This piece of code below is in the App.ts. Here you can set the thermostat to the desired temperature and range.
The link is where the update data comes from.(later more about the Azure)
![app](/img/app_v0.8.png)

In the HttpThermostat you can choose also a unit. If you give no unit, it will be standard "celsius".

![setThermostat](/img/set.png)

At the unit part you can choose of

- celsius
- fahrenheit
- kelvin

! If you do not provide an unit then this is standard 'celsius'

Rhe current temperature is automatically downloaded from [azure sensor](http://dummy-sensors.azurewebsites.net/api/sensor/abba5).If you surf to that site, you will get something as you can see below

![azure sensor](/img/azureSensor.png)

To run the code you have to

```sh
ts-node ./index.ts
```

### example 1

![example](/img/example1.png)

As a result, you will get this back in your shell.
the first part are the thermostat settings.
The second part is an update of the temperature
In the third part you will see that the cooling is switched on.

### example 2

![example](/img/example2.png)

Here do you see that the heating is switched on.

### example 3

![example](/img/example3.png)

Here do you see that the heating and cooling are turned off. This is because the update temperature is in the range.

## NPM

Set stuff on NPM

```sh
npm version <new version number>
npm publish
```

[link to the npm of the home-automation](https://www.npmjs.com/package/@lauradebaets/home-automation)

## Generated documentation

TypeDoc is used to generate the documentation. Tor run it, you must run the following commando

```sh
typedoc --out docs src
```

The documentaion can be downloaded here -> [documentation website](https://vives-software-engineering-2020.github.io/home-automation-debaetslaura/)

## Linter

Linter analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs.

```sh
npm run lint
```

## Tests

The tests are done with Jest. To run the tests you must run the following commando

```sh
npm run test
```

## License

Distributed under the MIT License. See ``License.txt``  for more information.

## Author information

De Baets Laura

Student at VIVES Brugge Elektronica -ICT

e-mail: laura.debaets@student.vives.be