README.md 2.69 KB
Newer Older
Thomas Eimers's avatar
Thomas Eimers committed
1
# Heating control (Fußboden-Heizungssteuerung)
Thomas Eimers's avatar
Thomas Eimers committed
2

Thomas Eimers's avatar
Thomas Eimers committed
3
[Heating Control Blog](https://www.notdefine.de/projects.php?project=heizungssteuerung-mit-raspberry-pi)
Thomas Eimers's avatar
Thomas Eimers committed
4

Thomas Eimers's avatar
Thomas Eimers committed
5
6
7
![Applicatiuon Preview](https://www.notdefine.de/projects/heizungssteuerung-mit-raspberry-pi/sensor-list.jpeg "Show all configured sensors")
![Applicatiuon Preview](https://www.notdefine.de/projects/heizungssteuerung-mit-raspberry-pi/temp.svg "Show temperature graph")

8
9
![System Structure](https://notdefine.de/projects/heizungssteuerung-mit-raspberry-pi/umweltdiagramm.png "System structure")
![Service Structure](https://notdefine.de/projects/heizungssteuerung-mit-raspberry-pi/ServiceStructure.png "Service structure")
10

Thomas Eimers's avatar
Thomas Eimers committed
11

Thomas Eimers's avatar
Thomas Eimers committed
12
## Sytem  Requirements
Thomas Eimers's avatar
Thomas Eimers committed
13

Thomas Eimers's avatar
Thomas Eimers committed
14
- PHP 7.3 for the Application
Thomas Eimers's avatar
Thomas Eimers committed
15
- xdebug 2.5 for Code Coverage
Thomas Eimers's avatar
Thomas Eimers committed
16
- npm 3.5.2 for using swagger-codegen
Thomas Eimers's avatar
Thomas Eimers committed
17
- node 10
Thomas Eimers's avatar
Thomas Eimers committed
18

Thomas Eimers's avatar
Thomas Eimers committed
19
## System Setup on a Raspberry PI
Thomas Eimers's avatar
Thomas Eimers committed
20
21

[Setup of the Raspberry operating system](SETUP.md)
Thomas Eimers's avatar
Thomas Eimers committed
22

Thomas Eimers's avatar
Thomas Eimers committed
23
24
25
26
27
28
## Run Application

### Setup Database for backend

It is needed to setup the database on the system first. (see [Setup.md](SETUP.md))

29
```bash
Thomas Eimers's avatar
Thomas Eimers committed
30
cd backend
Thomas Eimers's avatar
Thomas Eimers committed
31
32
composer doctrine-init
```
Thomas Eimers's avatar
Thomas Eimers committed
33

Thomas Eimers's avatar
Thomas Eimers committed
34
### Run backend application for local testing
35
```bash
Thomas Eimers's avatar
Thomas Eimers committed
36
cd backend
37
38
composer up
composer run serve
Thomas Eimers's avatar
Thomas Eimers committed
39
```
Thomas Eimers's avatar
Thomas Eimers committed
40

Thomas Eimers's avatar
Thomas Eimers committed
41
[Access the local running backend http://localhost:8081](http://localhost:8081) 
Thomas Eimers's avatar
Thomas Eimers committed
42
[Access the backend on Raspberry PI http://heating:88](http://heating:88) 
Thomas Eimers's avatar
Thomas Eimers committed
43
44
45


### Run frontend application for local testing 
Thomas Eimers's avatar
Thomas Eimers committed
46

Thomas Eimers's avatar
Thomas Eimers committed
47
If you call the frontend without the 'api' get parameter for the backend API it would show some dummy data.
Thomas Eimers's avatar
Thomas Eimers committed
48

49
```bash
Thomas Eimers's avatar
Thomas Eimers committed
50
51
cd frontend
npm install
Thomas Eimers's avatar
Thomas Eimers committed
52
./node_modules/@angular/cli/bin/ng serve
Thomas Eimers's avatar
Thomas Eimers committed
53
```
Thomas Eimers's avatar
Thomas Eimers committed
54

Thomas Eimers's avatar
Thomas Eimers committed
55
[Access the local running frontend http://localhost:4200](http://localhost:4200) 
Thomas Eimers's avatar
Thomas Eimers committed
56

Thomas Eimers's avatar
Thomas Eimers committed
57
### Combine
Thomas Eimers's avatar
Thomas Eimers committed
58

Thomas Eimers's avatar
Thomas Eimers committed
59
http://localhost:4200/?api=http:%2F%2localhost:8081
Thomas Eimers's avatar
Thomas Eimers committed
60

Thomas Eimers's avatar
Thomas Eimers committed
61
## Local development
Thomas Eimers's avatar
Thomas Eimers committed
62

Thomas Eimers's avatar
Thomas Eimers committed
63
### Test Backend Application
Thomas Eimers's avatar
Thomas Eimers committed
64

65
```bash
Thomas Eimers's avatar
Thomas Eimers committed
66
cd backend
Thomas Eimers's avatar
Thomas Eimers committed
67
php composer.phar run lint
Thomas Eimers's avatar
Thomas Eimers committed
68
php composer.phar run tests
Thomas Eimers's avatar
Thomas Eimers committed
69
php composer.phar run phpcs (phpcs-fix for auto correction errors)
Thomas Eimers's avatar
Thomas Eimers committed
70
71
```

Thomas Eimers's avatar
Thomas Eimers committed
72
### Generate static API documentation via swagger
Thomas Eimers's avatar
Thomas Eimers committed
73

74
```bash
Thomas Eimers's avatar
Thomas Eimers committed
75
cd backend
76
php composer.phar add-swagger-uiswagger
Thomas Eimers's avatar
Thomas Eimers committed
77
78
```

Thomas Eimers's avatar
Thomas Eimers committed
79
### Edit Swagger configuration file
80

81
```bash
82
83
84
docker run -p 80:8080 swaggerapi/swagger-editor
```

Thomas Eimers's avatar
Thomas Eimers committed
85
[Access the Editor on http://localhost:80](http://localhost:80)
86

Thomas Eimers's avatar
Thomas Eimers committed
87
88
89
90
91
### Get Logs

```bash
tail -f /var/log/syslog
```
92

Thomas Eimers's avatar
Thomas Eimers committed
93
94
## API

95
96
97
98
99
100
101
102
103
- http://heating.fritz.box:88/api/sensors
- http://heating.fritz.box:88/api/sensors/10-00080282b5f8
- http://heating.fritz.box:88/api/sensorByName/Au%C3%9Fen
- http://heating.fritz.box:88/api/sensorSettings/10-00080282b5f8
- http://heating.fritz.box:88/api/relay

// Get Relay controller Status
- http://heating.fritz.box:88/api/control/1
watcher
Thomas Eimers's avatar
Thomas Eimers committed
104

105
106
107
## Documentation

- [Contribute](CONTRIBUTING.md)
108
- [Umweltdiagramm](docs/umweltdiagramm.md)
109
- [ServiceStructure](docs/ServiceStructure.md)