Multiple devices in CASE statement


#1

1) Give a description of the problem
I am trying to use a CASE statement with multiple devices. This is probably easy, but I just cannot get the syntax correct. I am using Echo Speaks and the wasLastSpokenToDevice attribute. I have a CASE statement that works. But how do I use multiple devices in a single CASE statement? Currently I am duplicating the CASE statement with each individual Echo device. Can I list multiple devices and not duplicate so much code?


#2

Does not work…


#3

I would just change the SWITCH statement’s Case Traversal Policy (see its Options) to “Fall-through”, then edit the SWITCH-CASE block, e.g.:

switch({LastEcho})
   case {@Echo_Great_Room}:
   case {@other_room_variable1}:
   case {@other_room_variable2}:
      with
         whatever
      do
         whatever;
      end with;
      wait xxx;
      with
         whatever2
      do
         whatever2;
      end with;
      break
  case {@Echo_Bathroom}:
  case {other_variable3}:
     .
     .
     .
  case {other_variableX}:
     with
         whatever1
      do
         whatever1;
      end with;
      wait xxxxx;
      with
         whatever3
      do
         whatever3;
      end with;
      break
end switch;

#4

Ah, genius! Thank you sir!


#5

I referred to this again. And again, brillaint!!