# @maximva/home-automation

> Home automation package

Latest version **0.8.3** (published 2020-05-12) · The Unlicense license · 0 weekly downloads

## Install

```sh
npm install @maximva/home-automation
pnpm add @maximva/home-automation
yarn add @maximva/home-automation
bun add @maximva/home-automation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.3 |
| Published | 2020-05-12 |
| First published | 2020-03-25 |
| Weekly downloads | 0 |
| License | The Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 607.1 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | Maxim Vanden Abeele |
| Maintainers | maximva |

## Links

- npm: https://www.npmjs.com/package/@maximva/home-automation
- Repository: https://github.com/vives-software-engineering-2020/home-automation-maximva
- Homepage: https://github.com/vives-software-engineering-2020/home-automation-maximva#readme
- Issues: https://github.com/vives-software-engineering-2020/home-automation-maximva/issues
- npm.io page: https://npm.io/package/@maximva/home-automation

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.19.2
- [typedoc](https://npm.io/package/typedoc.md) ^0.17.4
- [typescript](https://npm.io/package/typescript.md) ^3.8.3
- [@types/node](https://npm.io/package/@types/node.md) ^12.12.31

## Recent versions

- 0.8.3 (latest) — 2020-05-12
- 0.8.2 — 2020-05-12
- 0.8.1 — 2020-05-08
- 0.8.0 — 2020-05-08
- 0.7.2 — 2020-05-01
- 0.7.1 — 2020-05-01
- 0.7.0 — 2020-05-01
- 0.6.0 — 2020-04-22
- 0.5.1 — 2020-04-21
- 0.5.0 — 2020-04-21
- 0.4.3 — 2020-03-27
- 0.4.2 — 2020-03-27
- 0.4.1 — 2020-03-26
- 0.4.0 — 2020-03-25

## README

# Home Automation Package

![npm badge](https://img.shields.io/npm/v/@maximva/home-automation?color=green)
![ESLint](../../workflows/ESLint/badge.svg?branch=master)
![Markdown Linter](../../workflows/Markdown%20Linter/badge.svg?branch=master)
![Tests](../../workflows/Tests/badge.svg?branch=master)

The Home Automation Package - HAP for short - has been developed to provide a solid base for developing home automation applications. It is still in the works but as of now it can be used to provide thermostat settings as a JSON string and get a JSON string back with the appropriate action to take for the heating/cooling system in your house.
Also, using the HTTPThermostat class a API url can be provided to fetch temperature data.

## How to go about installing it

This is a short one:

```bash
npm install @maximva/home-automation
```

## Examples

### HTTP Thermostat class

```typescript
import { HTTPThermostat } from '@maximva/home-automation'
import { JSONThermostat } from '@maximva/home-automation'
import {TemperatureConverter } from '@maximva/home-automation'
import { HttpTemperatureSensor } from '@maximva/home-automation'
import httpClient from 'axios'

const settings = {
    temperature : 20,
    range : 2,
    unit : "celsius"
}
const currentTemperature = {
    temperature: 21,
    unit: "celsius"
}

const temperatureConverter = new TemperatureConverter()
const jsonThermostat = new JsonThermostat(settings, temperatureConverter)
const httpSensor = new HttpTemperatureSensor('http://dummy-sensors.azurewebsites.net/api/sensor/abba5', httpClient)
const httpThermostat = new HTTPThermostat(httpSensor, jsonThermostat)

httpThermostat.getStatus()
.then( response => {
    console.log(response)
})

```

## HTTP Temperature Sensor class

```typescript
import HttpTemperatureSensor from '@maximva/home-automation'
import httpClient from 'axios'

let httpSensor: HttpTemperatureSensor = new HttpTemperatureSensor('http://dummy-sensors.azurewebsites.net/api/sensor/abba5', httpClient)
httpSensor.getTemperature()
.then( response => {
    console.log(response)
})
```

### JSON Thermostat class

```typescript
import { JSONThermostat } from '@maximva/home-automation'

const settings = {
    temperature : 20,
    range : 2,
    unit : "celsius"
}
const currentTemperature = {
    temperature: 21,
    unit: "celsius"
}
const temperatureConverter = new TemperaturConverter()
const jsonThermostat = new JsonThermostat(settings, temperatureConverter)
console.log(jsonThermostat.update(currentTemperature))
```

### Temperature Converter class

```typescript
import { TemperatureConverter } from '@maximva/home-automation'

const celsiusTemperature = 20
const temperature_converter = new TemperatureConverter()

console.log(`Temperature in fahrenheit: ${temperature_converter.celsiusToFahrenheit(celsiusTemperature)}`)
```

## License

Have a look here for more information about the license:
[The Unlicense](https://github.com/vives-software-engineering-2020/home-automation-maximva/blob/master/LICENSE.md)

## Author

Maxim Vanden Abeele - Student at University College Vives, Belgium

---
_Source: https://npm.io/package/@maximva/home-automation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
