Steps to publish a plugin

OK. There were a couple of small changes that I hadn’t published. Honestly, I didn’t think anybody was using this, so I haven’t been as diligent about keeping up with the Github repository as I normally try to be. Please download the latest version from the master branch, which has a couple of fixes, one of which may be related to your problem. It’s masked by something going on in openLuup that I haven’t yet figured out (when there’s an error, no message is emitted to the log), but I’ll track that down separately.

OK, those changes that you made allowed the plugin to run and I’m seeing the prototype debug and log entries. However, I get an error when calling my action:

2020-09-24 15:50:49.091   openLuup.server:: GET /data_request?id=action&output_format=json&DeviceNum=198&serviceId=urn:buxton-vera:serviceId:EchoBridge1&action=SendAnnouncement&myAnnouncement=this%20is%20a%20test&myDevice= HTTP/1.1 tcp{client}: 0x56201e728a98
2020-09-24 15:50:49.092   luup.call_action:: 198.urn:buxton-vera:serviceId:EchoBridge1.SendAnnouncement 
2020-09-24 15:50:49.093   openLuup.context_switch::  ERROR: [dev #198] [string "I_EchoBridge1.xml"]:54: attempt to index global 'pluginModule' (a nil value)

Line 54 refers to the SetDebug name

The string “pluginModule” doesn’t exist in the current version of the code. Can you check and make sure you are using the latest master release version of all the framework files (the I_.xml in particular for this case), and any stray files from other versions are completely removed, and check to make sure you don’t have both .lzo and non-lzo of any files–this will also create problems.

There is a reference to it in the README file, but that would not cause you to get a runtime error from code. That’s been updated.

Yeah that was from my action call from the previous version of the template. I made the change and the plugin now runs fine. I did however have to rename my action function from “sendAnnouncement” to “actionsendAnnouncement” in the lua file to get it to work.

Additionally I have one last hurdle:

2020-09-25 18:48:51.416 luup_log:198: Home Assistant, Vera Echo Bridge[notice]: Request Body:(“{"message":["This is a test"],"data":{"method":"all","type":"announce"}}”)

This is the JSON encoded message being sent to Home Assistant. I’m using DKJson to encode the string. The problem is the two brackets around the message [“This is a test”]. I believe HA is not parsing the bracketed message as a string and I’m not sure where the brackets are creeping into the formatting, as I have not changed DKJson, nor have I changed the way the string is encoded. I am passing two parameters as a single table to “local function pluginDispatchAction( action, dev, params )” (echo message and echo device name) so maybe that function is returning a table, and that’s why the message encodes with brackets.
The http error I’m getting reflects a bad encode"

2020-09-25 18:48:51.426 luup_log:198: Home Assistant, Vera Echo Bridge[notice]: URL request result h:({ connection=“close”, content-type=“text/plain; charset=utf-8”, date=“Sat, 26 Sep 2020 01:48:51 GMT”, content-length=“16”, server=“Python/3.8 aiohttp/3.6.2” })
2020-09-25 18:48:51.427 luup_log:198: Home Assistant, Vera Echo Bridge[notice]: Returned data is: (“HTTP 400 Bad Request”)

I tried to get around this by bypassing the action function using:

return PFB.impl.sendAnnouncement( lul_device, lul_settings.myAnnouncement, lul_settings.myDevice ) in the I_ file instead of using the return PFB.impl.pluginDispatchAction( "sendAnnouncement", lul_device, {lul_settings.myAnnouncement, lul_settings.myDevice}) but I could not get the sendAnnouncement action recognized by the plugin.

So I’m 99% there but cannot see a way to get rid of the brackets.

Whatever you are passing to dkjson.encode() is giving message as an array containing a string rather than a string.

OK, I solved this by using myMessage = concat(myMessage), so plugin the action function is returning a table when sent a table.

All is good.
Thx