Author Topic: Determine stateVariable dataType?  (Read 274 times)

Offline tinman

  • Full Member
  • ***
  • Posts: 215
  • Karma: +16/-0
Determine stateVariable dataType?
« on: July 13, 2018, 11:57:24 am »
Is it possible to determine if a device stateVariable is defined as a boolean? I believe that Vera ignores whatever dataType is given for a stateVariable in the device's S_.....xml file. I'd like to determine programatically if a device variable is boolean since we can't really directly save a lua boolean value. Typically lua boolean values of true and false are saved as 1 and 0 when updating a boolean device variable. If you knew when a device variable dataType was boolean you could do the conversion whenever you get or set the variable.

Online akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Determine stateVariable dataType?
« Reply #1 on: July 13, 2018, 03:09:37 pm »
AFAIK, the answer is no.

The reason is that Vera has completely flouted the UPnP rules in terms of data values and data types, rendering most of the metadata in the service and implementation files as good as useless.

For device variables, the truth is that everything is a string; some strings represent numbers; booleans are 0 or 1, mostly.

You just have to live with it!
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.