ctucx.git: smartied

[nimlang] smarthome server

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163 
164 
165 
166 
167 
{
 	"devices": {
		"modbus-10": {
			"type": "RelayBoard",
			"firstRegister": 0,
			"count": 4,
			"address": 10
		},
		"modbus-20": {
			"type": "RelayBoard",
			"firstRegister": 0,
			"count": 4,
			"address": 20
		},
		"modbus-50": {
			"type": "PowerMeter",
			"model": "SDM120",
			"address": 50
		},
		"modbus-60": {
			"type": "PowerMeter",
			"model": "SDM120",
			"address": 60
		},
		"tradfri-lamp1": {
			"type": "Zigbee2MqttLamp",
			"lampType": "RGB",
			"deviceName": "ikea_lamp_rgb"
		},
		"tradfri-lamp2": {
			"type": "Zigbee2MqttLamp",
			"lampType": "WhiteSpectrum",
			"deviceName": "ikea_lamp_whitespectrum"
		},
		"tradfri-lamp3": {
			"type": "Zigbee2MqttLamp",
			"lampType": "Switchable",
			"deviceName": "ikea_lamp_switchable"
		},
		"tradfri-relay1": {
			"type": "Zigbee2MqttRelay",
			"deviceName": "ikea_control_outlet"
		},
		"tradfri-remote1": {
			"type": "Zigbee2MqttRemote",
			"deviceName": "ikea_remote",
			"actions": {
				"toggle": {"type": "SwitchStateAction", "deviceName": "modbus-10", "relay": 0, "toggle": true}
			}
		},
		"lacrosse-raum": {
			"type": "LacrosseTempSensor",
			"id": "21"
		},
		"lacrosse-kuehlschrank": {
			"type": "LacrosseTempSensor",
			"id": "3a"
		},
		"lacrosse-draussen": {
			"type": "LacrosseTempSensor",
			"id": "26"
		},
		"lacrosse-bad": {
			"type": "LacrosseTempSensor",
			"id": "3f"
		}
	},
	"clientConfigs": {
		"smarthome-pwa": {
			"views": [
				{
					"url": "lights",
					"name": "Lights",
					"icon": "lightbulb",
					"type": "switches",
					"switches": [
						{ "name": "Decke (abgedunkelt)", "device": "modbus-10", "relay": 0 },
						{ "name": "Decke", "device": "modbus-10", "relay": 2 },
						{ "name": "Küche", "device": "modbus-10", "relay": 1 },
						{ "name": "Bett", "device": "modbus-10", "relay": 3 },
						{ "name": "Bad", "device": "modbus-20", "relay": 0 },
						{ "name": "Decke: RGB", "device": "tradfri-lamp1", "relay": 0 },
						{ "name": "Decke: Weiß-Spektrum", "device": "tradfri-lamp2", "relay": 0 },
						{ "name": "Decke: Schaltbar", "device": "tradfri-lamp3", "relay": 0 }
					]
				},
				{
					"url": "switches",
					"name": "Switches",
					"icon": "power_settings_new",
					"type": "switches",
					"switches": [
                        { "name": "Lüfter", "device": "modbus-20", "relay": 3 },
						{ "name": "Lüfter (leise)", "device": "modbus-20", "relay": 2 },
						{ "name": "Tradfri Steckdose", "device": "tradfri-relay1", "relay": 0 },
					]
				},
				{
					"url": "powermeter",
					"name": "Power Meter",
					"icon": "power",
					"type": "powermeter",
					"meters": [
						{ "name": "Sonstiges", "device": "modbus-50" },
						{ "name": "Küche", "device": "modbus-60" }
					]
				},
				{
					"url": "temperature",
					"name": "Temperature",
					"icon": "brightness_7",
					"type": "temperature",
					"sensors": [
						{ "name": "Kühlschrank", "device": "lacrosse-kuehlschrank" },
						{ "name": "Raum", "device": "lacrosse-raum" },
						{ "name": "Bad", "device": "lacrosse-bad" },
						{ "name": "Draussen", "device": "lacrosse-draussen" }
					]
				},
				{
					"url": "departures",
					"name": "Departures",
					"icon": "departure_board",
					"type": "departures",
					"source": "https://f2k1.de/haltestellen.php"
				},
				{
					"url": "fritzbox",
					"name": "Fritz!Box",
					"icon": "router",
					"type": "redirect",
					"destination": "http://192.168.178.1/"
				},
				{
					"url": "settings",
					"name": "Settings",
					"icon": "settings",
					"type": "settings",
					"sourceLink": "https://cgit.ctu.cx/smarthome-pwa"
				}
			]
		}
	},
	"serverConfig": {
		"frontendPort": 5000,
		"modbus": {
			"host": "10.0.0.1",
			"port": 502
		},
		"mqtt": {
			"host": "10.0.0.1",
			"port": 1883
		},
		"lacrosse": {
			"host": "10.0.0.1",
			"port": 2342
		},
		"influx": {
			"host": "10.0.0.1",
			"port": 8086,
			"powermetersDatabase": "test_powermeters",
			"sensorsDatabase": "test_sensors"
		},
		"powermeterUpdateIntervalSec": 20,
		"accessToken": "penis123"
	}
}