Guest User

Untitled

a guest
Sep 4th, 2017
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.89 KB | None | 0 0
  1. #
  2. # TRANSIT MODE
  3. # Detect whether I have taken a bike or the car with me
  4. # Default to Transit if none out
  5. #
  6. # NONE (home)
  7. # TRANSIT (not_home but bikes/car are home)
  8. # BIKE (not_home and at least one bike not_home)
  9. # DRIVE (not_home and car not_home)
  10.  
  11. - alias: "Welcome Back - Brad's Transit Mode is None"
  12.   trigger:
  13.     platform: state
  14.     entity_id: device_tracker.brad
  15.     to: 'home'
  16.   action:
  17.     - service: variable.set_variable
  18.       data:
  19.         variable: transit_mode
  20.         value: "None"
  21.     - service: variable.set_variable
  22.       data:
  23.         variable: transit_bike
  24.         value: "None"
  25.  
  26. # If I take car out, mark mode as driving
  27. - alias: "Brad's Transit Mode is Driving"
  28.   trigger:
  29.     platform: state
  30.     entity_id: device_tracker.brad
  31.     to: 'not_home'
  32.   condition:
  33.     condition: state
  34.     entity_id: device_tracker.beacon_element
  35.     state: 'not_home'
  36.   action:
  37.     - service: variable.set_variable
  38.       data:
  39.         variable: transit_mode
  40.         value: "Drive"
  41.  
  42. # If I take car out, mark mode as driving
  43. - alias: "Brad's Transit Mode is Public Transit"
  44.   trigger:
  45.     platform: state
  46.     entity_id: device_tracker.brad
  47.     to: 'not_home'
  48.   condition:
  49.     - condition: state
  50.       entity_id: device_tracker.beacon_element
  51.       state: 'home'
  52.     - condition: state
  53.       entity_id: device_tracker.beacon_bike_xo1
  54.       state: 'home'
  55.     - condition: state
  56.       entity_id: device_tracker.beacon_bike_saga
  57.       state: 'home'
  58.   action:
  59.     - service: variable.set_variable
  60.       data:
  61.         variable: transit_mode
  62.         value: "Transit"
  63.  
  64. - alias: "Brad's Transit Mode is Bike (XO-1)"
  65.   trigger:
  66.     platform: state
  67.     entity_id: device_tracker.brad
  68.     to: 'not_home'
  69.   condition:
  70.     - condition: state
  71.       entity_id: device_tracker.beacon_element
  72.       state: 'home'
  73.     - condition: state
  74.       entity_id: device_tracker.beacon_bike_xo1
  75.       state: 'not_home'
  76.     - condition: state
  77.       entity_id: device_tracker.beacon_bike_saga
  78.       state: 'home'
  79.   action:
  80.     - service: variable.set_variable
  81.       data:
  82.         variable: transit_mode
  83.         value: "Bike"
  84.     - service: variable.set_variable
  85.       data:
  86.         variable: transit_bike
  87.         value: "Bridgestone XO-1"
  88. - alias: "Brad's Transit Mode is Bike (Saga)"
  89.   trigger:
  90.     platform: state
  91.     entity_id: device_tracker.brad
  92.     to: 'not_home'
  93.   condition:
  94.     - condition: state
  95.       entity_id: device_tracker.beacon_element
  96.       state: 'home'
  97.     - condition: state
  98.       entity_id: device_tracker.beacon_bike_xo1
  99.       state: 'home'
  100.     - condition: state
  101.       entity_id: device_tracker.beacon_bike_saga
  102.       state: 'not_home'
  103.   action:
  104.     - service: variable.set_variable
  105.       data:
  106.         variable: transit_mode
  107.         value: "Bike"
  108.     - service: variable.set_variable
  109.       data:
  110.         variable: transit_bike
  111.         value: "Soma Saga"
Advertisement
Add Comment
Please, Sign In to add comment