Commit be5b9d67 authored by Alexis Brenon's avatar Alexis Brenon
Browse files

馃敩 End of experiment: faulty sensors

parents bbe3c83c 2cea4c2e
......@@ -32,6 +32,17 @@ function class:__init(args)
end
end
if args.faulty_sensors then
for _, id in ipairs(args.faulty_sensors) do
self.SENSORS_SET[id] = nil
for i, s_id in ipairs(self.SENSORS) do
if id == s_id then
table.remove(self.SENSORS, i)
break
end
end
end
end
end
function class:actions()
......@@ -279,40 +290,83 @@ class.SENSORS_GLOBAL = {
"fffe9da3a50a", "fffeb8a8ccbb", "fffe97678aad", "fffe3ce1bcaa",
"chan0rsb", "chan1rsb", "chan2rsb", "chan3rsb", "chan4rsb", "chan5rsb", "chan6rsb", "chan7rsb"
"chan0rsb", "chan1rsb", "chan2rsb", "chan3rsb", "chan4rsb", "chan5rsb", "chan6rsb", "chan7rsb",
"user1command",
}
class.USER_LOCATIONS_RESTRICTED = {
'kitchen',
'bedroom',
-- 'study'
}
class.USER_ACTIVITIES_RESTRICTED = {
'eat',
-- 'clean',
'sleep',
-- 'read',
-- 'phone',
'dish',
'cook',
'tidy',
'none',
}
class.USER_ACTIVITIES_RESTRICTED = {'eat', 'sleep', 'tidy', 'none'}
class.USER_COMMANDS_RESTRICTED = {
'light - on',
'light - off',
'radio - on',
'radio - off',
'blind - open',
'blind - close',
-- 'curtain - open',
-- 'curtain - close',
-- 'tts - time',
-- 'tts - temperature',
-- 'phone - help',
-- 'phone - son'
}
class.AVAILABLE_COMMANDS_RESTRICTED = {
'light - on',
'light - off',
'radio - on',
'radio - off',
'blind - open',
'blind - close',
-- 'curtain - open',
-- 'curtain - close',
-- 'tts - time',
-- 'tts - temperature',
-- 'phone - help',
-- 'phone - son',
'none'
}
class.COMMAND_LOCATION_RESTRICTED = {
light = {
-- "kitchen - all",
"kitchen - sink",
"kitchen - ceiling",
-- "bedroom - all",
"bedroom - bed",
"bedroom - ceiling",
-- "study - ceiling"
},
radio = {'bedroom'},
blind = {
"kitchen",
"bedroom",
-- "study"
},
curtain = {'bedroom'},
tts = {
"kitchen",
"bedroom",
"study"
},
phone = {'study'},
none = {'none'},
}
class.BASE_MODEL_RESTRICTED = {
['none'] = {
['any'] = {
......@@ -327,12 +381,23 @@ class.BASE_MODEL_RESTRICTED = {
['eat'] = {{'light - on', 'kitchen - ceiling'}},
['dish'] = {{'light - on', 'kitchen - sink'}},
['cook'] = {{'light - on', 'kitchen - sink'}},
['any'] = {{'light - on', 'kitchen - ceiling'}}
['any'] = {
-- {'light - on', 'kitchen - all'},
{'light - on', 'kitchen - sink'},
{'light - on', 'kitchen - ceiling'},
}
},
['bedroom'] = {
['sleep'] = {{'light - on', 'bedroom - bed'}},
['any'] = {{'light - on', 'bedroom - ceiling'}}
['any'] = {
-- {'light - on', 'bedroom - all'},
{'light - on', 'bedroom - bed'},
{'light - on', 'bedroom - ceiling'},
}
},
['study'] = {
['any'] = {{'light - on', 'study - ceiling'}},
}
},
['light - off'] = {
......@@ -340,12 +405,34 @@ class.BASE_MODEL_RESTRICTED = {
['eat'] = {{'light - off', 'kitchen - ceiling'}},
['dish'] = {{'light - off', 'kitchen - sink'}},
['cook'] = {{'light - off', 'kitchen - sink'}},
['any'] = {{'light - off', 'kitchen - ceiling'}}
['any'] = {
-- {'light - off', 'kitchen - all'},
{'light - off', 'kitchen - sink'},
{'light - off', 'kitchen - ceiling'},
}
},
['bedroom'] = {
['sleep'] = {{'light - off', 'bedroom - bed'}},
['any'] = {{'light - off', 'bedroom - ceiling'}}
['any'] = {
-- {'light - off', 'bedroom - all'},
{'light - off', 'bedroom - bed'},
{'light - off', 'bedroom - ceiling'},
}
},
['study'] = {
['any'] = {{'light - off', 'study - ceiling'}},
}
},
['curtain - open'] = {
['any'] = {
['any'] = {{'curtain - open', 'bedroom'}}
}
},
['curtain - close'] = {
['any'] = {
['any'] = {{'curtain - close', 'bedroom'}}
}
},
['blind - open'] = {
......@@ -355,6 +442,9 @@ class.BASE_MODEL_RESTRICTED = {
['bedroom'] = {
['any'] = {{'blind - open', 'bedroom'}}
},
['study'] = {
['any'] = {{'blind - open', 'study'}}
},
},
['blind - close'] = {
['kitchen'] = {
......@@ -363,6 +453,54 @@ class.BASE_MODEL_RESTRICTED = {
['bedroom'] = {
['any'] = {{'blind - close', 'bedroom'}}
},
['study'] = {
['any'] = {{'blind - close', 'study'}}
},
},
['radio - on'] = {
['any'] = {
['any'] = {{'radio - on', 'bedroom'}}
}
},
['radio - off'] = {
['any'] = {
['any'] = {{'radio - off', 'bedroom'}}
}
},
['tts - time'] = {
['kitchen'] = {
['any'] = {{'tts - time', 'kitchen'}},
},
['bedroom'] = {
['any'] = {{'tts - time', 'bedroom'}},
},
['study'] = {
['any'] = {{'tts - time', 'study'}},
},
},
['tts - temperature'] = {
['kitchen'] = {
['any'] = {{'tts - temperature', 'kitchen'}},
},
['bedroom'] = {
['any'] = {{'tts - temperature', 'bedroom'}},
},
['study'] = {
['any'] = {{'tts - temperature', 'study'}},
},
},
['phone - help'] = {
['any'] = {
['any'] = {{'phone - help', 'study'}},
}
},
['phone - son'] = {
['any'] = {
['any'] = {{'phone - son', 'study'}},
}
},
}
class.SENSORS_RESTRICTED = class.SENSORS_GLOBAL
......
......@@ -27,8 +27,10 @@ function class:update(action_index)
end
self.state[sensor_id] = value
end
if self.sensors.user1command then
self.state.user1command = self.state.user1inferredcommand
end
-- Remove inferences
self.state.user1command = self.state.user1inferredcommand
self.state.user1inferredcommand = nil
self.state.user1inferredactivity = nil
self.state["user1inferredlocation_" ..
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment