Virtual Thermostat Piston


1) Give a description of the problem
I’m working on using a virtual thermostat to control my window air conditioner via webCoRE for when summertime comes. I’ve got the temperature and humidity being fed to the thermostat by a multisensor, but only the temperature is being updated in the thermostat. Can anyone help with why the humidity isn’t working?

2) What is the expected behavior?
Virtual thermostat temperature and humidity to be updated via Aeotec Multisensor 6

3) What is happening/not happening?
Temperature updates, humidity doesn’t

4) Post a Green Snapshot of the piston

12/25/2017, 9:43:46 PM +75ms
+1ms ╔Received event [Thermostat].temperature = 74.3 with a delay of 65ms
+9417ms ║RunTime Analysis CS > 19ms > PS > 9329ms > PE > 69ms > CE
+9418ms ║Piston waited at a semaphore for 9265ms
+9419ms ║Runtime (39581 bytes) successfully initialized in 9329ms (v0.2.100.20171211) (9418ms)
+9420ms ║╔Execution stage started
+9424ms ║║Cancelling statement #1’s schedules…
+9456ms ║║Executed physical command [Thermostat].setTemperature([74.3]) (24ms)
+9457ms ║║Executed [Thermostat].setTemperature (25ms)
+9488ms ║║Executed physical command [Thermostat].setHumidityPercent([28]) (25ms)
+9489ms ║║Executed [Thermostat].setHumidityPercent (27ms)
+9496ms ║║Comparison (decimal) 74.3 is_greater_than_or_equal_to (decimal) 71.0 = true (1ms)
+9497ms ║║Condition #11 evaluated true (6ms)
+9498ms ║║Condition group #4 evaluated true (state did not change) (7ms)
+9500ms ║║Cancelling statement #5’s schedules…
+9505ms ║║Skipped execution of physical command [Christmas Lights].on([]) because it would make no change to the device. (3ms)
+9506ms ║║Executed [Christmas Lights].on (3ms)
+9513ms ║║Comparison (decimal) 74.3 is_less_than_or_equal_to (decimal) 67.0 = false (1ms)
+9514ms ║║Condition #10 evaluated false (6ms)
+9515ms ║║Condition group #7 evaluated false (state did not change) (8ms)
+9517ms ║╚Execution stage complete. (97ms)
+9518ms ╚Event processed successfully (9518ms)
12/25/2017, 9:43:45 PM +275ms

Copy an attribute from a real device to a virtual device

Just an updated snapshot showing restrictions added. Also I’ve got the outlet for my air conditioner coming on at the cooling setpoint but for some reason the outlet won’t turn off when it drops to the heating setpoint.


I’m still needing help with the humidity part, but seems as though I’ve going about turning outlet on and off the wrong way. Changed rules to use operating state instead of setpoints and works.

Some may wonder why I’m trying to use a virtual thermostat anyway and it’s because I’ve got baseboard heaters with knobs in them that can’t be electronically controlled plus window air conditioners.


Got a link to the device handler you used for the virtual thermostat?


Sure do - it’s the simulated thermostat shown when creating device handler from template:



I was able to set the simulated humidity using this command… I used an Expression instead of a Physical device. I’m going to try it with Physical device next.


Edit: It worked both ways for me.

Edit2: I imported your last piston and I see that there’s no event trigger that updates your virtual thermostat with the temp and humidity information. I just updated it to include the trigger, no other changes.


Thanks so much - I’ve got another piston that runs fine without the trigger and guess I thought you didn’t need one. Much appreciated!


On you’re going to kill me but I tried using the code and had no luck. Tried re-creating the code and had no luck. The temperature and humidity don’t update and can’t get switch to turn on or off. Can you help?


Will try when I get back to a computer.


Ok, back for a few mins on a pc. Observations for now… on your original piston, you’re looking at thermostatOperatingState of cooling and heating. The switches will not turn on or off if the AC is not actually cooling or heating, maybe you’re looking for thermostatMode instead?

Edit: I saw what you were talking about regarding the Temp updating but not the Humidity. I’m going to try and add a wait in there to see if it helps.


Well I’m trying to emulate a thermostat as much as possible so when a normal thermostat would be in cooling state I’d like AC to turn off and when hearing kicks on turn AC off. I started creating he piston trying to use heating and cooling setpoints.


Ok I restored a previous version and with this everything works the way I’d like except for the humidity part.


The only way I was able to make the virtual thermostat to take the temp and humidity at the same time is this way… please give it a try. I didn’t change anything else on the piston. You’ll need to edit the device name in the Expression editor to reflect your device names.


Wow I’m being a pain in the neck so thanks for being patient. With that said, still no luck.


No prob, more curiosity on my end lol. What does your piston look like now?


Wait hold that thought! You’re the best - it just kicked in.


If you’re up for some more though I’d like one last thing. Want a way so when you turn this off it’ll disable the piston. I’m not sure if adding restrictions is the eat way to go or not and quite frankly at this I’m nervous to make any changes because it’s working now.


This is where I’m at now…


I’m guessing your restriction Thermostat's thermostatMode is not off would take care of that? The piston would work in heat, cool, or auto.


If the switch was already turned on and then turned thermostat off it didn’t turn switch off. If switch was already off and then turned thermostat off it did prevent piston from running.