[LUA] Plugin installation toruble

Hi,
I’m new to Vera (and Lua, and Z-Wave for that matter) and trying to create some automation logic like controlling blinds and window opening to prevent overheating, a simple alarm … For this I’d like to create a device with multiple user-selectable statuses like Away, Home, On Vacation, … and attached logic. So far I have created some config and lua files as described in the Luup_Plugins_ByHand and Luup_Somfy_Walkthrough wiki articles, and uploaded them via the App > Develop Apps > LUUP files interface. I have also created a device with the device type urn:schemas-k1-com:device:MyHome:1 and (I/D)_MyHome.xml as implementation/device files.

However i end up with an empty device (no buttons) and no useful log messages except (62 is the deviceid)
01 05/23/14 9:08:55.704 Device_LuaUPnP::CreateImplementations Aborting 62 because it failed to load <0x2ad2c000>
01 05/23/14 9:08:55.704 JobHandler_LuaUPnP::CreateAllImplementations failed to create 62 <0x2ad2c000>

Could someone please point me in the right direction?

Cheers
Maro?

First step is to make sure that your XML files are well-formed XML, and that your JSON files are well-formed JSON. A common mistake is to forget to escape the less-than characters in the Lua sections of the implementation XML file.

There is likely an error earlier in the log too, so double check for any other messages.

No, the json and xml is perfectly valid (the syntax, not necessarily the schema or content) - I have verified the syntax with xmllint and JSON::XS from Perl prior to asking this question.
Also forgot to add a link to the plugin source code in my initial post MyHomeVera/plugin at master · maros/MyHomeVera · GitHub. As you can see most of the configuration is copied from the working simple alarm plugin and verry little has been changed - so i guess that there shouldn’t be any serious errors there. Also there seem to be no syntax errors in the lua code (checked on my local box)

I took your files and added them to my Vera. After a reload the device appears (see screenshot).

So I would be looking at your file upload and device creation methodology. Some guidelines:

  • Never, ever, use Internet Explorer.
  • Check that you haven’t accidentally made any files in UTF-16 encoding or start with byte-order marks.
  • When you create the device, make sure there are no spaces or other extraneous characters around the field where you typed “D_MyHome1.xml”. Leave the Implementation field empty; it’s mentioned in the device file anyway.
  • Press SAVE or RELOAD at the top right of the Vera interface liberally.
  • Refresh your browser liberally, making sure you clear the cache when you do it. All browsers have a shortcut for doing this.

You do have an error in the Lua, which will be stopping the plugin from running, but you should at least see the device.

01	05/24/14 10:39:37.853	LuaInterface::CallFunction_Startup-1 device 281 function initialize failed [string "--..."]:57: attempt to call global 'readSettings' (a nil value) <0x2ba5b680>
01	05/24/14 10:39:37.853	LuImplementation::StartLua running startup code for 281 I_MyHome1.xml failed <0x2ba5b680>

Great! Removing and re-adding the device fixed the issue. Thank you futzle!

However two minor problems remain:

  1. Even though the “Status” variable is set, the button associated with the status is not displayed as active. How do i tell the widget to activate the button besides adding a “Value” key in the buttons “Display” section in the display json file?

  2. The device shows up with a question mark and no controls in the AutHomation app. Does AutHomation support generic devices or do they have to add support for each device type individually?

The JSON file is where you do it. I take it you’ve already read the reverse-engineered docs here. That won’t take effect until you Reload/Save the Vera UI and you refresh your browser while clearing the cache.

2. The device shows up with a question mark and no controls in the AutHomation app. Does AutHomation support generic devices or do they have to add support for each device type individually?

Each mobile app has to add support for each custom device. If you need control from your phone then you can create scenes that press the buttons on your new device. All apps support scenes.