Virtual Thermostat Piston


#20

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.


#21

See if this works… I only added the bottom IF.


#22

One thing I have noticed though is temperature and humidity won’t always update. I’m not sure what it is, but it seems like the pistons not always running or something, but if I go in an press test piston it’ll immediately update the numbers.


#23

You’re right about that, remember I mentioned it earlier in the thread… there’s no trigger for the following…

image


#24

I didn’t want to ruin first piston that kicks switch and off plus semi updates temps so I created another piston and paused first. Then I created new piston with triggers for temps and humidity which work great. But what am I doing wrong because the switch no longer kicks on or off?


#25

I dragged your other IF in line 30 that watches the thermostat out of the ‘on events’ block.


#26

Kicks switch on but not off. Temp stopped updating.


#27

Something is breaking in the setTemp and setHumidity…

a3a020ef-9c99-4948-be5e-631227af027a  10:55:44 AM: error groovy.lang.MissingMethodException: No signature of method: script_dth_629898c3_eaa3_4ba1_b13a_e6f4fc106ef9_ver_1_0.setHumidityPercent() is applicable for argument types: (java.lang.String) values: [32]
a3a020ef-9c99-4948-be5e-631227af027a  10:55:44 AM: error org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '69.4' with class 'java.lang.String' to class 'java.lang.Integer'

I have to keep redoing it each time we recreate the piston, if I import yours, then I have to redo it so that it will update both the humidity and temp.

Edit: These are the steps I have to do to make sure the temp and humidity updates. If not, then I get that error message above:

  1. select setHumidityPercent
  2. Click Parameters > Delete Parameter 1
  3. Click Parameters > Add an integer parameter
  4. Select your Physical Device then Relative Humidity

Do the same for Temperature except select “Add a decimal parameter”


#28

I still didn’t have any luck and so I’m wondering if I can just use the original piston without the trigger for temp/humidity be executed by a separate piston? I know it’s not the simplest way to go I’m sure and seems as though it should be able to be done in one piston, but I’m not able to do it.

Original piston:

Trigger piston:

How bad of an idea is this?


#29

There’s no bad idea if it works :slight_smile:


#30

Ok so it didn’t work. Still had to change the state of he thermostat for temperature to update. It’s so close but yet not finished. I’m at a loss.


#31

Would it have anything to do with that handler or something? I’m using this code in another piston to send temps to virtual temperature sensors and works like a charm.


#32

I’ve modified the piston a little bit since I posted earlier and the following is the result I’m getting. Ignore the last two devices in the ‘on events’ as I needed something to trigger the piston more often for my test.

Some logs showing switch turning on when cooling, off on idle.

12/27/2017, 3:30:48 PM +529ms
+1ms	╔Received event [Sim Thermostat].thermostatOperatingState = idle with a delay of 168ms
+164ms	║Runtime (39462 bytes) successfully initialized in 46ms (v0.2.100.20171211) (162ms)
+165ms	║╔Execution stage started
+241ms	║║Executed [sim SW4].off (32ms)
+244ms	║╚Execution stage complete. (80ms)
+245ms	╚Event processed successfully (245ms)
12/27/2017, 3:30:04 PM +24ms
+1ms	╔Received event [Sim Thermostat].thermostatOperatingState = cooling with a delay of 327ms
+9662ms	║Piston waited at a semaphore for 9522ms
+9664ms	║Runtime (39536 bytes) successfully initialized in 9548ms (v0.2.100.20171211) (9662ms)
+9665ms	║╔Execution stage started
+9696ms	║║Executed [sim SW4].on (3ms)
+9714ms	║╚Execution stage complete. (49ms)
+9715ms	╚Event processed successfully (9715ms)
12/27/2017, 3:30:03 PM +444ms
+2ms	╔Received event [SugaBloom].temperature = 75.0 with a delay of 179ms
+186ms	║Runtime (39438 bytes) successfully initialized in 55ms (v0.2.100.20171211) (183ms)
+187ms	║╔Execution stage started
+499ms	║║Executed [Sim Thermostat].setTemperature (294ms)
+545ms	║║Executed [Sim Thermostat].setHumidityPercent (38ms)
+663ms	║║Executed [sim SW4].on (46ms)
+685ms	║╚Execution stage complete. (499ms)
+686ms	╚Event processed successfully (686ms)

#33

Ok it’s working. One last question - do you know anything about editing code in device handlers? I’ve wondered if there’s a way to change the look of devices in the SmartThings app. Like could I remove a tile, rearrange tiles, etc.?


#34

I have experience but no good result lol. I tried following the docs but kept getting sidetracked, now thinking back I don’t even remember what device handler I was wanting to edit in the first place.


#35

Have you seen this? Might be something you can use.


Working Thermostat Piston
#36

I just checked it out and installed handler and smartapp, but it’s only for heating. Great potential because he thermostat his smartapp creates keeps up with the temperature rock solid whereas I’m still struggling with my piston. What’s weird is now I’ve got a settable temperature sensor that’s noblonger keeping up either. If I adjust the setpoints of the thermostat and toggle the mode to heating or cooling it’ll update instantly. The Settable temp sensor I’m not sure about - hit the test button in the piston and does nothing. They’ll both eventually change, but take a while.


#37

The piston seems to be setting the temperature, but then for some reason the temperature changes on its own.


#38

I’m starting to play with virtual thermostats as well and found that my temperature automatically adjusts to match the setpoint Temps a few seconds after the setpoint Temps are changed to trigger the device to heat or cool. This is without using webcore. Why? I can’t control it using webcore if it always forces itself back to idle.


#39

Hello, i have temperature sensors and i want to do a thermostat, but… Can i do the webcore read the values from a mysql, so i can control with a web made for me . Thanks.