Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fb6dd2e
Move config of services to json
durinfab Feb 4, 2021
99c5439
Config: Added device-groups and removed deprec. functions
durinfab Feb 10, 2021
8d129b3
Docker: Added new Docker System from Master
durinfab Feb 10, 2021
98404ed
Reconf: Fixed device-group import
durinfab Feb 10, 2021
0faf547
Git: Merged current master
durinfab Feb 11, 2021
691a1a5
Neo4j: Add Automations and Device Groups to DB
durinfab Feb 14, 2021
86f5804
Config: Added search for main devices
durinfab Feb 19, 2021
39dd6c7
Neo4j: Added maindevice relations to database
durinfab Feb 21, 2021
b4bf9b8
Rekonf: Added simple reconfiguration algorithm
durinfab Feb 24, 2021
75c1589
Rekonf: remember not instantiated devices
durinfab Mar 3, 2021
93ca2ec
Rekonf: Readded service starting
durinfab Mar 3, 2021
f8bdafa
Rekonf: Devices are no longer usable multiple times in one service
durinfab Mar 6, 2021
821506d
Rekonf: Fixed bug - same device can be multiple times in automation
durinfab Mar 6, 2021
d70b606
Merge branch 'master' into serv_w/_json_conf
durinfab Mar 7, 2021
b6516f5
Rekonf: Fixed missing instantiation
durinfab Mar 7, 2021
41cad54
Rekonf: Merged alias and uuid
durinfab Mar 7, 2021
dea0a73
Rekonf: Send config to devices
durinfab Mar 13, 2021
90ab4fc
Rekonf: added api for db
durinfab Mar 18, 2021
9964fe6
Rekonf: cleanup & renaming
durinfab Mar 21, 2021
59b7916
state updates are now applied to neo4j
durinfab Mar 31, 2021
c95fbcd
Reconf: Added automatic reconfiguration on malfunction
durinfab Apr 4, 2021
061987e
Reconf: Added comments
durinfab Apr 5, 2021
8a9f16b
Merge branch 'master' into serv_w/_json_conf
durinfab Apr 5, 2021
312f6ca
Reconf: Added type of service to database
durinfab Apr 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions reconf/config/device-groups/lights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"name": "lights",
"types": ["ceiling-lamp", "light-stip"]
}
]
6 changes: 6 additions & 0 deletions reconf/config/device-groups/switches.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"name": "switches",
"types": ["wall-switch", "remote-switch"]
}
]
9 changes: 9 additions & 0 deletions reconf/config/serviceconf/bedroomLamp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[{
"type": "ceiling-lamp-switch",
"uuid": "bed1",
"mainDevices": ["bri", "fra"],
"replacementDevices": "",
"room": "bedroom",
"configMsg": "",
"online": true
}]
27 changes: 27 additions & 0 deletions reconf/config/serviceconf/bedroomSwitches.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[{
"type": "wall-switch",
"uuid": "bri",
"mainDevices": [],
"replacementDevices": "switches",
"room": "bedroom",
"configMsg": "",
"online": true
},
{
"type": "remote-switch",
"uuid": "fra",
"mainDevices": [],
"replacementDevices": "switches",
"room": "bedroom",
"configMsg": "",
"online": true
},
{
"type": "remote-switch",
"uuid": "fra2",
"mainDevices": [],
"replacementDevices": "switches",
"room": "bedroom",
"configMsg": "",
"online": true
}]
4 changes: 4 additions & 0 deletions reconf/config/services/remote-switch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"image": "light-switch",
"args": []
}
4 changes: 4 additions & 0 deletions reconf/config/services/wall-switch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"image": "light-switch",
"args": []
}
24 changes: 24 additions & 0 deletions reconf/src/PersistentStorage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ServiceEntry } from "./db";

/** The service UUID. */
export type Uuid = string;
export type Room = string;

/** The string describing the type of a service. */
export type ServiceType = string;

/** The array of selected service type and instances. */
export type ServiceSelection = [ServiceType, ServiceEntry[]][];
/** Options for specifying which changes need to be made in the database. */
export type ConfigUpdates = {
del: Uuid[];
};

export interface PersistentStorage {
createService(service: ServiceEntry): void;
updateService(service: ServiceEntry): Promise<void>;
removeService(uuid: Uuid): Promise<void>;
queryServices(): Promise<ServiceEntry[]>;
queryService(uuid: Uuid): Promise<ServiceEntry | undefined>;
queryServicesInRoom(room: Room): Promise<ServiceEntry[]>;
};
3 changes: 2 additions & 1 deletion reconf/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'source-map-support/register';
import { env as getEnv, util } from 'horme-common';
import fail from './fail';
import srv from './service';
import db, { initMissingServices } from './db';
import { resetDatabase } from './neo4j';

const env = getEnv.readEnvironment('reconf');
Expand All @@ -22,7 +23,7 @@ main().catch((err) => util.abort(err));
async function main() {
logger.setLogLevel(env.logLevel);
await resetDatabase();
await db.initializeDatabase();
await fail.setupFailureListener();
await srv.configureServices();
logger.info('initial configuration instantiated, listening...');
}
Loading