Stumped on implementing an action for my thermostat plugin

I’m writing a plugin to control a thermostat (Essent E-Thermostaat). To set the operating mode, I want to use the standard upnp HVAC_UserOperatingMode service. So I’ve included this in my D_***.xml file as a service.

Now when I implement an action from the UserOperatingMode service in my implementation file in the actions list (see below) my Vera can no longer parse the implementation file. In the LuaUPnP.log file I see:

01 02/09/13 17:51:08.668 LuaInterface::LoadCode: [string “…”]:284: ‘’ expected near ‘end’ <0x2af22000>
01 02/09/13 17:51:08.729 Device_Interface::CreateLuaInterface 12 failed to start engine <0x2af22000>

I know the Implementation file itself is correct, when I rename the action to something not specified by upnp (for example ‘DummyModeTarget’), everything parses normally.

What’s going on here? Do I need another way to implement the standard actions or should I stay away from them? Quite lost at the moment…

Snippet from my implementation file:

 <action>
  <serviceId>urn:upnp-org:serviceId:HVAC_UserOperatingMode1</serviceId>
  <name>SetModeTarget</name>
  <run>
      luup.log('modecalled')
      end
  </run>
</action>

Snippet from my D_*** file:

  <service>
    <serviceType>urn:schemas-upnp-org:service:HVAC_UserOperatingMode:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:HVAC_UserOperatingMode1</serviceId>
    <SCPDURL>S_HVAC_UserOperatingMode1.xml</SCPDURL>
  </service>

[quote=“jouked, post:1, topic:174261”]
urn:upnp-org:serviceId:HVAC_UserOperatingMode1
SetModeTarget

luup.log(‘modecalled’)
end

[/quote]

Looks to me like the “end” above does not match any Lua block, and should be removed.

Also if you want to make sure that your thermostat plugin works with 3rd party apps, you should use much of the standards as possible.

  • Garrett

Solved!

:smiley: It’s my first plugin, after ending every function with ‘end’ I got so used to it that it didn’t occur to me to leave it out in this section… Thanks for this, it now works as planned!