Adding a New Variable

Hello, I’m on UI7.

I’m finding it difficult to find out exactly how I use the Add New Service/Variable/Value. I really have tried searching but get constant Lua references and not this feature below each device we can input.

My question is I would like to add a variable and I might be going the wrong direction with this so please tell me.

I have a network device pinged by a plugin, WOL Ping Sensor. I want to add a variable that uses On and Off instead of 0 or 1 because I use the SMTP plugin to give me the status of that variable by email and custom text I add to it.

Should I be trying to use this feature or modifying the some Lua code somewhere else to make it say On or Off instead of 0 or 1?

If you add a new variable … you have to write code to maintain that variable anytime the status of the device changes.
All of it is doable in LUA code. Multiple ways to do it.
[hr]
OR you can use Vera Alerts.
It has template support to extract any variable and transform it. The following shows how to convert the light status:
A message with the following format:

Device  9: {device([9].service[urn:upnp-org:serviceId:SwitchPower1].Status) | Choose(0=Off,1=On)}  !

Will cause a message that looks like:
Device 9: On !

In the Advanced Tab for your Scene … add Device Vera Alert, SendAlert action.
There is also ways to call this from LUA … read the documentation for that.
[hr]
Or you can use PLEG
If you have an input named “SWITCH”
and in the action (Advanced TAB) you can send to your favorite notification plugin (of course mine is Vera Alerts, but you can use the smtp plugin)

       Device: VeraAlertsPlugin
       Action:  SendAlert
       Msg:     Device {(SWITCH ? "On" : "Off")} !
       Recipient:    SMTPProfile, AndroidPhoneProfile

Thanks Richard, very helpful.