Message Tags... IF-THEN-ELSE possible?

I’m just starting to read about Message Tags and not sure if I need If/Then ability or I may be missing what would accomplish my goals. For example…

IF ‘Alarm Panel’ == “Away” THEN {tone:5} ELSE {tone:1}
… in this case, Alarm Panel is a Multi-Switch device

This is useful since many of the devices have different uses based on different ‘Home/Security Modes’. A door sensor is an Alarm trigger when you are not home, but you may want it silent, or a small ‘non-alarming’ chime sound when you are home - in case your 4 year old decides to open the front door on his own :wink:
Same could be said for motion sensors, etc.

Yes, Templates have a choose method for strings. The following is how you make a switch say yes or no even though the values are 0 or 1.

“Test Device {device([9].Switch.Status) | Choose(0=Off,1=On,Other=Unknown)} !”

You can use it to map:
Choose(0={tone:3},1={tone:5})

UPDATED

Hi Richard,
Thx for the help on this!

I’m not getting this to fully work but it may be a bug in the Virtual Switch?
I put this code in 3 notifications…
DOOR SENSOR {device([152].Switch.Status) | Choose(0={tone:3},1={tone:1})}
… I verified none of my Virtual Switchs are changing status (under Advanced tab), they are always 0 … is this normal?

Ideally I want to get this working with a Multi-Switch (my “alarm panel”), which is essentially 8 switches in one - how can we do this?

Here’s my Multi-Switch…

Button1: Away
Button2: Home
Button3: Returning
Button4: Leaving
Button5: Sleep
Button6:
Button7: Chime
Button8: Vacation

The Advanced tab does not dynamically update. You will not see property changes there. They are a snapshot at some point in time … Not sure of when … Might be the first time the device is inspected … might be the first time any device is inspected.

You have to reload the browser to get new fresher data.

There is not an easy way to get a single value from the multi-switch … They are considered multiple different switches … even though there is an option to give them a radio like behavior. Is there a status coming back from your alarm system that would be better suited ?

It seems no matter what the Virtual Switch state is (on/off), Veralert gets status=0 every time. I have tried several times with several Virtual Switches.

My “alarm” is my Vera + wave sensors… not a commercial panel. Get the Virtual Switches to work is completely acceptable but the Multi-Switch would be preferable as it would act like a true ‘security status panel’.

You probably have the wrong service ID for the variable.
It’s does not use the same Service ID as a normal switch.

[quote=“RichardTSchaefer, post:6, topic:176868”]You probably have the wrong service ID for the variable.
It’s does not use the same Service ID as a normal switch.[/quote]

Can I buy a vowel? :wink:

Advanced properties shows… Device #152

Template: {device([152].service[urn:upnp-org:serviceId:VSwitch1].Status)}

I never created a Service Alias for the VSwitch.

Vowels are expensive !!!

You can have an unlimited number of earcons …
Basically it’s a name from the sender’s side and on the phone you associate a sound file to that name … it plays that sound when the message is received.

I do not think I will add more tones at this time.

Hi Richard,
Things have been working great for me - thank you.

one more related question…

I need to make the alert tone change based on multiple Virtual Devices (which track the security mode) - if we had a way for multi-switch to work it might eliminate this need but until then hopefully you can help?

STAY-SECURE mode ON = tone:3
STAY-nonSECURE mode ON = tone:1
AWAY mode ON = tone:4

my current template only considers device:
LAUNDRY DOOR Lock{device([152].service[urn:upnp-org:serviceId:VSwitch1].Status) | Choose(0={tone:1},1={tone:3})}

… is it possible to have the tome based on 3 devices values?

thx!

Use some additional logic (PLEG or LUA) to create a single variable with options 1-N and use that to drive the tone.