HVAC Commands

I am looking to make a scene activate when HVAC_OperatingState1 changes to “Heating” and another one when it switches back to “Idle.” (and in heating mode). I am just guessing at how to do this but since I am a complete newbie to this I’m lost. I found some similar code but only 1 thread that uses OperatingState1.

I was going to make an attempt at the code but the forum won’t let me. “Sorry, you are not allowed to post external links”.

I was basing my version off of this http://forum.micasaverde.com/index.php/topic,7691.msg49514.html#msg49514

Also this code (once finished) would go in the Luup screen when creating a new scene?

Any help in getting down the right path is appreciated.

Here is what I’m trying right now.

I also added a “else return false” but it doesn’t seem to work.

Any ideas?

I can’t even get the variables to display in the log. I’m trying the following:

[code]luup.log(“Start Variable Dump*******”)

luup.log(luup.variable_get(“urn:micasaverde-com:serviceId:HVAC_OperatingState1”,“ModeState”,2))

luup.log(luup.variable_get(“urn:upnp-org:serviceId:HVAC_FanOperatingMode1”,“Mode”,2))[/code]

But get:

50 12/26/12 14:54:33.896 luup_log:0: ***************Start Variable Dump********************** <0x2d40f680> 01 12/26/12 14:54:33.896 luup_log interface 0x755e70 args 0 <0x2d40f680> 01 12/26/12 14:54:33.897 luup_log interface 0x755e70 args 0 <0x2d40f680>

Any help on what I’m doing wrong would be appreciated.

For the logging part, try putting the value of variable_get into a variable first, and then logging that variable as a separate call to luup.log()

variable_get returns 2 values. The first is the value and the second is a time stamp value when the value last changed.

luup.log also takes two values. The first is the string to log, and the second is the log level. I suspect that using one inside the other is causing the condition you are seeing.

It would als e worth double checking that your TStats deviceId is really 2. Seems kinda low

You can confirm what services are available using the command below in your browser:
http://:3480/data_request?id=lu_invoke&DeviceNum=
Replace and with details from you unit and device.
E.g. http://192.168.1.2:3480/data_request?id=lu_invoke&DeviceNum=402

If you do it with Chrome, it will display this in the browser and include the drill down hyperlinks. If you do this within IE, it should prompt you to download and allow you to select what to open it in e.g. Word etc. If you use would, it will contain active hyperlinks.

Can you achieve the same by utilising the advanced tab as an example attached without the need to use the code?

Thanks for the tip, Brientim. I’ve bookmarked that tidbit. :slight_smile:

That doesn’t seem to list everything available. urn:micasaverde-com:serviceId:HVAC_OperatingState1 doesn’t list anything.

I think I had the wrong device ID because this works:

if luup.variable_get ("urn:micasaverde-com:serviceId:HVAC_OperatingState1", "ModeState", 4)=="Idle" then return true else return false end

When I look in the config, I saw the device ID listed as 2 though. Obviously I’m not looking at something right. The attached image shows what I looked at.

As per the attached example, if you go into the Advance Tab and place your mouse over the Variable this will display the Service being used because there is also urn:upnp-org:serviceId:HVAC_UserOperatingMode1

The alternative solution:
http://:3480/data_request?id=user_data&output_format=xml

Search for device id=“4
#=“4” extracted from the details provided or replace with the correct

It should display something like the example below:

<device id="4" id_parent="0" embedded="0" disabled="0" device_file="D_RTCOA_Wifi_ZoneThermostat1.xml" manufacturer="" altid="" mac="" time_created="1400781015" plugin="1618" subcategory_num="1" impl_file="I_RTCOA_Wifi_ZoneThermostat1.xml" name="RTCOA Wifi Thermostat" device_type="urn:schemas-hugheaves-com:device:HVAC_ZoneThermostat:1" ip="192.168.1.5" model="CT50 V1.94" room="16" local_udn="uuid:4d494342-5342-5645-0073-000001ccd0c4" category_num="5">
<states>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="LogLevel" value="20" id="0"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="InitialPollDelay" value="3" id="1"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="PollInterval" value="60" id="2"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="ForceHold" value="0" id="3"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="SyncClock" value="0" id="4"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="ProgramSetpoints" value="0" id="5"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="LooseTempControl" value="0" id="6"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="Programs" value="" id="7"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="EnergyLEDColor" value="Off" id="8"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="EnergyLEDSet" value="0" id="9"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="PMAMessage" value="" id="10"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="PMALine" value="0" id="11"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="PMASet" value="0" id="12"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="PMATempDevice" value="0" id="13"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="RemoteTempDevice" value="0" id="14"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="RemoteTempSet" value="0" id="15"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="RemoteTemp" value="0" id="16"/>
<state service="urn:upnp-org:serviceId:TemperatureSensor1" variable="CurrentTemperature" value="23" id="17"/>
<state service="urn:upnp-org:serviceId:HVAC_UserOperatingMode1" variable="ModeTarget" value="HeatOn" id="18"/>
<state service="urn:upnp-org:serviceId:HVAC_UserOperatingMode1" variable="ModeStatus" value="Off" id="19"/>
<state service="urn:upnp-org:serviceId:HVAC_UserOperatingMode1" variable="EnergyModeTarget" value="Normal" id="20"/>
<state service="urn:upnp-org:serviceId:HVAC_UserOperatingMode1" variable="EnergyModeStatus" value="Normal" id="21"/>
<state service="urn:upnp-org:serviceId:HVAC_FanOperatingMode1" variable="Mode" value="Auto" id="22"/>
<state service="urn:upnp-org:serviceId:HVAC_FanOperatingMode1" variable="FanStatus" value="On" id="23"/>
<state service="urn:upnp-org:serviceId:TemperatureSetpoint1_Heat" variable="CurrentSetpoint" value="21" id="24"/>
<state service="urn:upnp-org:serviceId:TemperatureSetpoint1_Cool" variable="CurrentSetpoint" value="26" id="25"/>
<state service="urn:schemas-hugheaves-com:serviceId:HVAC_RTCOA_TemperatureHold1" variable="Target" value="0" id="26"/>
<state service="urn:schemas-hugheaves-com:serviceId:HVAC_RTCOA_TemperatureHold1" variable="Status" value="0" id="27"/>
<state service="urn:micasaverde-com:serviceId:EnergyMetering1" variable="UserSuppliedWattage" value="0,0,0" id="28"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="PluginVersion" value="2.2" id="29"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" variable="CreateGenericDevice" value="0" id="30"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_TemperatureHold1" variable="Target" value="0" id="31"/>
<state service="urn:hugheaves-com:serviceId:HVAC_RTCOA_TemperatureHold1" variable="Status" value="0" id="32"/>
<state service="urn:micasaverde-com:serviceId:HVAC_OperatingState1" variable="ModeState" value="Idle" id="33"/>
<state service="urn:micasaverde-com:serviceId:HaDevice1" variable="LastUpdate" value="1354415638" id="34"/>
<state service="urn:upnp-org:serviceId:TemperatureSetpoint1_Heat" variable="HeatMax" value="" id="35"/>
<state service="urn:upnp-org:serviceId:TemperatureSetpoint1_Heat" variable="HeatMin" value="" id="36"/>
<state service="urn:upnp-org:serviceId:TemperatureSetpoint1_Cool" variable="CoolMax" value="" id="37"/>
<state service="urn:upnp-org:serviceId:TemperatureSetpoint1_Cool" variable="CoolMin" value="" id="38"/>
<ControlURLs>
<service_82 service="urn:upnp-org:serviceId:HVAC_FanOperatingMode1" ControlURL="/upnp/control/dev_82" EventURL="/upnp/event/dev_82" serviceType="urn:schemas-upnp-org:service:HVAC_FanOperatingMode:1"/>
<service_83 service="urn:micasaverde-com:serviceId:HVAC_OperatingState1" ControlURL="/upnp/control/dev_83" EventURL="/upnp/event/dev_83" serviceType="urn:micasaverde-com:serviceId:HVAC_OperatingState:1"/>
<service_84 service="urn:upnp-org:serviceId:HVAC_UserOperatingMode1" ControlURL="/upnp/control/dev_84" EventURL="/upnp/event/dev_84" serviceType="urn:schemas-upnp-org:service:HVAC_UserOperatingMode:1"/>
<service_85 service="urn:upnp-org:serviceId:FanSpeed1" ControlURL="/upnp/control/dev_85" EventURL="/upnp/event/dev_85" serviceType="urn:schemas-upnp-org:service:FanSpeed:1"/>
<service_86 service="urn:upnp-org:serviceId:TemperatureSensor1" ControlURL="/upnp/control/dev_86" EventURL="/upnp/event/dev_86" serviceType="urn:schemas-upnp-org:service:TemperatureSensor:1"/>
<service_87 service="urn:upnp-org:serviceId:TemperatureSetpoint1_Heat" ControlURL="/upnp/control/dev_87" EventURL="/upnp/event/dev_87" serviceType="urn:schemas-upnp-org:service:TemperatureSetpoint:1"/>
<service_88 service="urn:upnp-org:serviceId:TemperatureSetpoint1_Cool" ControlURL="/upnp/control/dev_88" EventURL="/upnp/event/dev_88" serviceType="urn:schemas-upnp-org:service:TemperatureSetpoint:1"/>
<service_89 service="urn:upnp-org:serviceId:SwitchPower1" ControlURL="/upnp/control/dev_89" EventURL="/upnp/event/dev_89" serviceType="urn:schemas-upnp-org:service:SwitchPower:1"/>
<service_90 service="urn:micasaverde-com:serviceId:EnergyMetering1" ControlURL="/upnp/control/dev_90" EventURL="/upnp/event/dev_90" serviceType="urn:schemas-micasaverde-com:service:EnergyMetering:1"/>
<service_91 service="urn:micasaverde-com:serviceId:HaDevice1" ControlURL="/upnp/control/dev_91" EventURL="/upnp/event/dev_91" serviceType="urn:schemas-micasaverde-com:service:HaDevice:1"/>
<service_92 service="urn:hugheaves-com:serviceId:HVAC_RTCOA_Wifi1" ControlURL="/upnp/control/dev_92" EventURL="/upnp/event/dev_92" serviceType="urn:schemas-hugheaves-com:service:HVAC_RTCOA_Wifi:1"/>
<service_93 service="urn:hugheaves-com:serviceId:HVAC_RTCOA_TemperatureHold1" ControlURL="/upnp/control/dev_93" EventURL="/upnp/event/dev_93" serviceType="urn:schemas-upnp-org:service:SwitchPower:1"/>
</ControlURLs>

That yields a gold mine of information. Thanks! Another one for the bookmarks.

Now I can start adding other conditions since I got the basic one working.

Well done, it worth the trial and error when you see there is something achievable. Good luck for the rest of this endeavour.