Author Topic: LUA Executes, but won't actually control Fan Mode on T-Stat  (Read 149 times)

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +5/-21
LUA Executes, but won't actually control Fan Mode on T-Stat
« on: December 08, 2017, 02:11:50 pm »
I have a Honeywell thermostat that supports having the "Fan Mode" controlled from the Vera web gui. I can choose from three settings including Fan Cycle, Continuous On, and Auto. I only ever want the fan to be set to Auto and am creating a scene to reset it if it gets changed.

I am able to properly detect the state change from Auto to one of the others (those options are available in the Trigger section, so they're easy to set) but I can't programmatically change it back to Auto. I'm missing something, and I don't know what... Here's my LUA code:

Code: [Select]
local HVAC_Thermostat_ID = 45
local HVAC_Fan_Status = luup.variable_get("urn:upnp-org:serviceId:HVAC_FanOperatingMode1","Mode",HVAC_Thermostat_ID)

if (HVAC_Fan_Status == "ContinuousOn") then
     luup.variable_set("urn:upnp-org:serviceId:HVAC_FanOperatingMode1","Mode","Auto",HVAC_Thermostat_ID)
     luup.call_action("urn:upnp-org:serviceId:HVAC_FanOperatingMode1","SetTarget",{ newTargetValue="Auto" },HVAC_Thermostat_ID)
end

return(true)

I have inspected the "Variables" that are set when the fan is put into different modes and the only one that appears to change is the one labeled "Mode" on the Variables page. Hovering over it shows that it's addressable as HVAC_FanOperatingMode1 as indicated exactly in my script.

The deviceID is correct.  :)

What am I missing?

Online RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9922
  • Karma: +749/-141
    • RTS Services Plugins
Re: LUA Executes, but won't actually control Fan Mode on T-Stat
« Reply #1 on: December 08, 2017, 03:33:26 pm »
You should NEVER set a variable on a device unless the device or plugin developer tells you that is part of the public API
Quote
luup.call_action("urn:upnp-org:serviceId:HVAC_FanOperatingMode1","SetModeTarget",{ NewModeTarget="AutoChangeOver" },HVAC_Thermostat_ID)
If you do not know what the correct action is ... turn on verbose logging ... than initiate the action (in this case  change the thermostat fan mode) from the Vera Dashboard, and see what is sent in the Vera Log file.

Online rigpapa

  • Full Member
  • ***
  • Posts: 190
  • Karma: +28/-0
Re: LUA Executes, but won't actually control Fan Mode on T-Stat
« Reply #2 on: December 09, 2017, 08:55:35 am »

...

Code: [Select]
    ...
     luup.call_action("urn:upnp-org:serviceId:HVAC_FanOperatingMode1","SetTarget",{ newTargetValue="Auto" },HVAC_Thermostat_ID)

I have inspected the "Variables" that are set when the fan is put into different modes and the only one that appears to change is the one labeled "Mode" on the Variables page. Hovering over it shows that it's addressable as HVAC_FanOperatingMode1 as indicated exactly in my script.

The deviceID is correct.  :)

What am I missing?

The service definition for HVAC_FanOperatingMode1 suggests that the correct action name is SetMode and the correct parameter name for that action is NewMode. And case matters. Try changing your action and see if that helps.
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, and Auto Virtual Thermostat plugins. Using Vera Plus (1.7.3232), Vera3 (1.7.855), 50 dimmers and 40 switches (mostly Leviton, some Linear and GE), a dozen sensors, a truckload of PLEG, and of course, my own plugins.

Online RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9922
  • Karma: +749/-141
    • RTS Services Plugins
Re: LUA Executes, but won't actually control Fan Mode on T-Stat
« Reply #3 on: December 09, 2017, 09:21:15 pm »
My bad  ... I used an action for thermostat mode with the fan mode service is. The strategy to handle this yourself is still correct. Check the Vera log file (verbose mode) to see the action ... service is . .. and  correct value as you manipulate the thermostat from the Vera ui.

Sent from my SAMSUNG-SM-G935A using Tapatalk


Offline ember1205

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +5/-21
Re: LUA Executes, but won't actually control Fan Mode on T-Stat
« Reply #4 on: December 10, 2017, 08:56:03 pm »
My bad  ... I used an action for thermostat mode with the fan mode service is. The strategy to handle this yourself is still correct. Check the Vera log file (verbose mode) to see the action ... service is . .. and  correct value as you manipulate the thermostat from the Vera ui.

Sent from my SAMSUNG-SM-G935A using Tapatalk

There's like 50 log files... Which one?

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +5/-21
Re: LUA Executes, but won't actually control Fan Mode on T-Stat
« Reply #5 on: December 10, 2017, 09:30:20 pm »
It -SEEMS- that the /tmp/log/cmh/LuaUPnP.log is the correct log.

I changed:

Code: [Select]
luup.call_action("urn:upnp-org:serviceId:HVAC_FanOperatingMode1","SetTarget",{ newTargetValue="Auto" },HVAC_Thermostat_ID)
to

Code: [Select]
luup.call_action("urn:upnp-org:serviceId:HVAC_FanOperatingMode1","SetMode",{ newModeValue="Auto" },HVAC_Thermostat_ID)
And it works fine now.

Thanks for the help.