-func (nsi SpaceTempSensor) MakeTempSensor(what, name, where, value, unit string) {
-
-}
-
-func (nsi SpaceInfo) MergeInSensorData(sensortype interface{}) {
- //todo check if what equals either "temperature", "door_locked", "barometer", "humidity", "beverage_supply", "power_consumption", "wind", "network_connections", "account_balance", "total_member_count", "people_now_present" or starts with "ext_". Else prepend "ext_"
- var what string
- switch sensortype := sensortype.(type) {
- case SpaceTempSensor:
- what = "temperature"
- case SpaceLightSensor:
- what = "ext_illumination"
- case SpacePowerConsumptionSensor:
- what = "power_consumption"
- case SpaceNetworkConnectionsSensor:
- what = "network_connections"
- case SpaceMemberCountSensor:
- what = "total_member_count"
- case SpaceDoorLockSensor:
- what = "door_locked"
- case SpaceDoorAjarSensor:
- what = "ext_door_ajar"
- default:
- panic("Unknown Sensor Type")
- }
-
+func MakeTempSensor(name, where, unit string, value float64) SpaceInfo {
+ listofwhats := make([]SpaceInfo, 1)
+ listofwhats[0] = SpaceInfo{
+ "value": value,
+ "unit": unit,
+ "location": where,
+ "name": name,
+ "description": ""}
+ return SpaceInfo{"temperature": listofwhats}
+}
+
+func MakeTempCSensor(name, where string, value float64) SpaceInfo {
+ return MakeTempSensor(name,where,"\u00b0C",value)
+}
+
+func MakeIlluminationSensor(name, where, unit string, value int64) SpaceInfo {
+ listofwhats := make([]SpaceInfo, 1)
+ listofwhats[0] = SpaceInfo{
+ "value": value,
+ "unit": unit,
+ "location": where,
+ "name": name,
+ "description": ""}
+ return SpaceInfo{"ext_illumination": listofwhats}
+}
+
+func MakePowerConsumptionSensor(name, where, unit string, value int64) SpaceInfo {
+ listofwhats := make([]SpaceInfo, 1)
+ listofwhats[0] = SpaceInfo{
+ "value": value,
+ "unit": unit,
+ "location": where,
+ "name": name,
+ "description": ""}
+ return SpaceInfo{"power_consumption": listofwhats}
+}
+
+func MakeNetworkConnectionsSensor(name, where, nettype string, value, machines int64) SpaceInfo {
+ listofwhats := make([]SpaceInfo, 1)
+ listofwhats[0] = SpaceInfo{
+ "value": value,
+ "type": nettype,
+ "machines": machines,
+ "location": where,
+ "name": name,
+ "description": ""}
+ return SpaceInfo{"network_connections": listofwhats}
+}
+
+func MakeMemberCountSensor(name, where string, value int64) SpaceInfo {
+ listofwhats := make([]SpaceInfo, 1)
+ listofwhats[0] = SpaceInfo{
+ "value": value,
+ "location": where,
+ "name": name,
+ "description": ""}
+ return SpaceInfo{"total_member_count": listofwhats}
+}
+
+func MakeDoorLockSensor(name, where string, value bool) SpaceInfo {
+ listofwhats := make([]SpaceInfo, 1)
+ listofwhats[0] = SpaceInfo{
+ "value": value,
+ "location": where,
+ "name": name,
+ "description": ""}
+ return SpaceInfo{"door_locked": listofwhats}
+}
+
+func MakeDoorAjarSensor(name, where string, value bool) SpaceInfo {
+ listofwhats := make([]SpaceInfo, 1)
+ listofwhats[0] = SpaceInfo{
+ "value": value,
+ "location": where,
+ "name": name,
+ "description": ""}
+ return SpaceInfo{"ext_door_ajar": listofwhats}
+}
+
+func (nsi SpaceInfo) MergeInSensor(sensorinfo SpaceInfo) {