new source promoted

This commit is contained in:
2019-10-27 22:56:00 +01:00
parent f781e24028
commit 93846dbbea
17 changed files with 52 additions and 383 deletions

101
source/mock.go Normal file
View File

@@ -0,0 +1,101 @@
package main
func createMockConfig() Configuration {
b1 := new(Board)
b1.ID = "47e41dc9-4a14-4b79-8644-d7442a15cb50"
b1.Name = "Virtual IO"
b1.Type = BoardTypeDummy
b1.ChannelCount = 40
b2 := new(Board)
b2.ID = "6561df75-bf93-43f5-82ac-9b3dda081961"
b2.Name = "Internal GPIO"
b2.Type = BoardTypeGPIO
b2.ChannelCount = 40
b3 := new(Board)
b3.Bus = 1
b3.Address = 0x29
b3.ID = "79690164-214f-41b0-93f9-e910dd54f323"
b3.Name = "bordo1"
b3.Type = BoardTypeI2CGPIO
b3.ChannelCount = 8
b4 := new(Board)
b4.Bus = 1
b4.Address = 0x27
b4.ID = "93f446d8-59e4-4abd-8bf7-e31cd80bc713"
b4.Name = "bordo2"
b4.Type = BoardTypeI2CADC
b4.ChannelCount = 4
return Configuration{
Hostname: "maramao",
MQTT: MQTTConfig{
BrokerIP: "192.168.2.190",
BrokerPort: "1883",
ClientID: "openpdu-123",
Username: "DVES_USER",
Password: "DVES_PASS",
CleanSession: false,
Topic: "openpdu/ok",
HomeAssistant: true,
},
Boards: []*Board{b1, b2, b3, b4},
Outlets: map[(uint)]Outlet{
0: Outlet{
Name: "uscita 0",
Location: "port 1 dx",
HasPowerMeter: true,
Command: Boardlink{
BoardID: b1.ID,
Channel: 0,
},
PowerMeter: Boardlink{
BoardID: b4.ID,
Channel: 0,
},
},
1: Outlet{
Name: "uscita 1",
Location: "port 1 sx",
HasPowerMeter: true,
Command: Boardlink{
BoardID: b1.ID,
Channel: 1,
},
PowerMeter: Boardlink{
BoardID: b4.ID,
Channel: 1,
},
},
2: Outlet{
Name: "uscita 2",
Location: "port 2 dx",
HasPowerMeter: false,
Command: Boardlink{
BoardID: "79690164-214f-41b0-93f9-e910dd54f323",
Channel: 2,
},
},
3: Outlet{
Name: "uscita 5v 1",
Location: "usb avanti 1",
HasPowerMeter: false,
Command: Boardlink{
BoardID: "47e41dc9-4a14-4b79-8644-d7442a15cb50",
Channel: 21,
},
},
4: Outlet{
Name: "uscita 5v 2",
Location: "usb avanti 2",
HasPowerMeter: false,
Command: Boardlink{
BoardID: "47e41dc9-4a14-4b79-8644-d7442a15cb50",
Channel: 22,
},
},
},
}
}