Automatic Trigger Generation for Rule-based Smart Homes ACM - - PowerPoint PPT Presentation

automatic trigger generation for rule based smart homes
SMART_READER_LITE
LIVE PREVIEW

Automatic Trigger Generation for Rule-based Smart Homes ACM - - PowerPoint PPT Presentation

Automatic Trigger Generation for Rule-based Smart Homes ACM SIGPLAN PLAS, Vienna, Austria 10-24-2016 Chandrakana Nandi, Michael D. Ernst UW Seattle, USA 2 3 Common architecture OR 4 How to control your home? 5 How to control your home?


slide-1
SLIDE 1

Automatic Trigger Generation for Rule-based Smart Homes

Chandrakana Nandi, Michael D. Ernst UW Seattle, USA

ACM SIGPLAN PLAS, Vienna, Austria 10-24-2016

slide-2
SLIDE 2

2

slide-3
SLIDE 3

3

slide-4
SLIDE 4

Common architecture

4

OR

slide-5
SLIDE 5

How to control your home?

5

slide-6
SLIDE 6

Automation rules:

when I come home then turn lights on

How to control your home?

6

slide-7
SLIDE 7

Automation rules are easy and useful

Ur+ CHI 2014, 2016 Ur+ HUPS 2014 Dey+ Pervasive 2006

How to control your home?

7

slide-8
SLIDE 8

Writing correct automation rules is hard How to control your home?

8

Huang+ Ubicomp 2015

slide-9
SLIDE 9

Writing correct automation rules is hard How to control your home?

9

Huang+ Ubicomp 2015

mental model actual rule

rule “start laundry” when Item laundry_machine changed then if (laundry_machine == FULL) { sendCommand(laundry_machine, “ON”) } end

slide-10
SLIDE 10

Effects of wrong rules

  • Likely unexpected behavior
  • Security vulnerabilities

10

slide-11
SLIDE 11

11

Overview

  • Background on automation rules
  • Problem statement
  • Solution
  • Algorithm and tool development
  • Experiments
slide-12
SLIDE 12

12

Overview

  • Background on automation rules
  • Problem statement
  • Solution
  • Algorithm and tool development
  • Experiments
slide-13
SLIDE 13

Rule Example

13

rule "Away rule" when Item State_Away changed

  • r Item State_Sleeping changed

then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-14
SLIDE 14

Rule Example

14

rule "Away rule" when Item State_Away changed

  • r Item State_Sleeping changed

then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-15
SLIDE 15

Rule Example

15

rule "Away rule" when Item State_Away changed

  • r Item State_Sleeping changed

then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

trigger block

slide-16
SLIDE 16

Rule Example

16

rule "Away rule" when Item State_Away changed

  • r Item State_Sleeping changed

then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

trigger item trigger item trigger block

slide-17
SLIDE 17

Rule Example

17

rule "Away rule" when Item State_Away changed

  • r Item State_Sleeping changed

then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

action block

slide-18
SLIDE 18

rule "Away rule" when Item State_Away changed

  • r Item State_Sleeping changed

then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

18

State_Away = ON State_Sleeping = ON

slide-19
SLIDE 19

19

Overview

  • Background on automation rules
  • Problem statement
  • Solution
  • Algorithm and tool development
  • Experiments
slide-20
SLIDE 20

Possible mistakes in rules

20

slide-21
SLIDE 21

Wrong trigger block

21

rule "Away rule" when Item State_Roomheater changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-22
SLIDE 22

Wrong trigger block

22

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-23
SLIDE 23

Wrong trigger block

23

rule "Away rule" when Item trigger_1 changed Item trigger_2 changed Item trigger_n changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-24
SLIDE 24

Conflicts

24

rule “rule 1” when Item owner_entering_home changed then if (owner_entering_home == true) { sendCommand (hall_light, “ON”) } end rule “rule 2” when Item past_midnight changed then if (past_midnight == true) { sendCommand (hall_light, “OFF”) } end

(owner_entering_home == true && past_midnight == true)

slide-25
SLIDE 25
  • Wrong trigger blocks
  • Conflicts

25

slide-26
SLIDE 26
  • Wrong trigger blocks
  • Conflicts

26

slide-27
SLIDE 27

Why is it bad?

27

slide-28
SLIDE 28

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

28

!(State_Away = ON && State_Sleeping = ON)

slide-29
SLIDE 29

29

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-30
SLIDE 30

30

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-31
SLIDE 31

31

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-32
SLIDE 32

32

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-33
SLIDE 33

33

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-34
SLIDE 34

34

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-35
SLIDE 35

35

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-36
SLIDE 36

36

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-37
SLIDE 37

37

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

slide-38
SLIDE 38

38

Both states can be set to true!

slide-39
SLIDE 39

rule "Visitor notification system rule" when Item State_Sleeping changed then if (State_Sleeping.state == ON) { postUpdate (Notification_System , OFF) } else { postUpdate (Notification_System , ON) } end

39

slide-40
SLIDE 40

Example Attack

rule "Visitor notification system rule" when Item State_Sleeping changed then if (State_Sleeping.state == ON) { postUpdate (Notification_System , OFF) } else { postUpdate (Notification_System , ON) } end rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end 40

Wrongly deactivates notification system

slide-41
SLIDE 41

41

Overview

  • Background on automation rules
  • Problem statement
  • Solution
  • Algorithm and tool development
  • Experiments
slide-42
SLIDE 42

rule "Away rule" when Item State_Away changed then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

Solution

42

slide-43
SLIDE 43

rule "Away rule" when Item State_Away changed

  • r Item State_Sleeping changed // Fix

then if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

Solution

43

slide-44
SLIDE 44

44

Overview

  • Background on automation rules
  • Problem statement
  • Solution
  • Algorithm and tool development
  • Experiments
slide-45
SLIDE 45

TrigGen: automatically infer triggers from actions using static analysis

45

Idea: live items must be triggers

slide-46
SLIDE 46

46

Idea: live items must be triggers

Items that are read from before being written to, at the beginning of the action block

slide-47
SLIDE 47

rule "Away rule" when Item State_Away changed then State_Notify = ON if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

47

slide-48
SLIDE 48

rule "Away rule" when Item State_Away changed then State_Notify = ON if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

  • Identify all items in the

action block AST ○ potential triggers

48

slide-49
SLIDE 49

rule "Away rule" when Item State_Away changed then State_Notify = ON if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

  • Identify all items in the

action block AST ○ potential triggers

49

slide-50
SLIDE 50

rule "Away rule" when Item State_Away changed then State_Notify = ON if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

  • Identify all items in the

action block AST ○ potential triggers

  • eliminate those that are

not live ○ redundant triggers ■ State_Notify

50

slide-51
SLIDE 51

rule "Away rule" when Item State_Away changed then State_Notify = ON if (State_Away.state == ON) { if (State_Sleeping.state != OFF) { postUpdate (State_Sleeping, OFF) } } end

  • Identify all items in the

action block AST ○ potential triggers

  • eliminate those that are

not live ○ redundant triggers ■ State_Notify

  • State_Away,

State_Sleeping: live

51

slide-52
SLIDE 52

Implementation

item repository rule identify all potential triggers eliminate redundant triggers by live variable analysis

52

rule "Rule 1" when trigger then action end

State_Notify State_Away State_Sleeping State_Away State_Sleeping Comparer State_Away Laundry_Machine State_Sleeping Laundry_Machine wrong/extra missing end-user written

slide-53
SLIDE 53

53

Overview

  • Background on automation rules
  • Problem statement
  • Solution
  • Algorithm and tool development
  • Experiments
slide-54
SLIDE 54

Experiments

  • 96 real end-user written rules for openHAB
  • Action block size: 1 - 220 LOC
  • Featuring categories such as

54

slide-55
SLIDE 55

Experiments

  • Ground truth

○ Set of necessary and sufficient triggers, i.e. all non-redundant triggers ○ Verified by ■ contacting the end user ■ manual inspection of rules

55

slide-56
SLIDE 56

Trigger generation

TrigGen suggested a set of necessary and sufficient triggers 91 (95%) False positives False negatives 5 (5%)

56

Missing triggers detected 77 (80%)

slide-57
SLIDE 57

Number of missing triggers

57

slide-58
SLIDE 58

Number of missing triggers

58

55%

slide-59
SLIDE 59

Conflicts

59

Total conflicts detected 18 True positives 11 (61%) False negatives

slide-60
SLIDE 60

More in the paper

Conflict resolution Group enumeration Proving non-live triggers as redundant

60

slide-61
SLIDE 61

Remarks

  • TrigGen is applicable to any domain that

has trigger based rules

  • We aimed at home automation involving

○ end users ○ different deployments: every home is different!

61

slide-62
SLIDE 62

Conclusions

TrigGen automatically generates a set of necessary and sufficient triggers so that rules don’t have:

  • likely unexpected behavior
  • certain security vulnerabilities

TrigGen found 80% real rules used for experimentation to have insufficient triggers

62

slide-63
SLIDE 63

63