Is this a good design? From CoRE to webCoRE


#1

I have 4 separate pistons in CoRE that I am bringing over to webCoRE. Being new to webCoRE, I was curious if what I have done in webCoRE is the most optimized way of accomplishing the task? It does seem to work correctly but I am not sure if I coded it the most optimal way.

What the 4 original CoRE pistons did…

If Temp is <= 85
AND
Time is between sunRISE and sunSET
Turn OFF Garage Fan

If Temp is >=90
AND
Time is between sunRISE and sunSET
Turn ON Garage Fan

If Temp is <= 90
AND
Time is between sunSET and sunRISE
Turn OFF Garage Fan

If Temp is >=95
AND
Time is between sunSET and sunRISE
Turn ON Garage Fan

…and my new (working) webCoRE…

This is my first webCoRE so any suggestions before I move on to all my other conversions?

Thanks!!


#2

Great first piston! Welcome aboard!!

There are a few things I would likely change.

  1. Let each of the 4 scenarios be in it’s own block of code. (exactly like you typed in your post)
  2. Drop the 5 minute timer entirely, and let the temperature become the trigger
  3. Use the sunRISE before the sunSET in all 4 scenarios:

IF Time is between sunrise and sunset... blah blah Daytime code
IF Time is NOT between sunrise and sunset... blah blah Nighttime code

This is because in some cases, spanning midnight can cause issues.


#3

There are many ways to accomplish our goals in webCoRE, but this is how I would do it:

Some of my logic behind this piston:

  • It lets you manually override it whenever you want by just toggling the fan (your piston above only lets you be spontaneous for a few minutes before it would revert back)
  • It no longer runs all day every day. (the more things happening at once, the more likely SmartThings will miss a command) I try to use triggers so the piston only runs when something happens. In this case, dropping or rising above a certain temperature…
    (the lightning bolts in the left column are the triggers)

To import this piston, just click on “New Piston” and then this button:
temp
Use the code yrvd and then just follow the prompts.

(and disable your previous piston during testing, so the commands are not duplicating)


#4

Thanks! That helps a ton.

I will give those changes a shot and let you know.


#5

I would do the same but use the OR statement so you only do one ON and one OFF.

If OR (sensor drops below 86 & time is between sunrise and sunset), (sensor drops below 91 & time is not between sunrise and sunset)

Then turn OFF

If OR (sensor rises above 89 & time is between sunrise and sunset), ( sensor rises above 94 & time is not between sunrise and sunset)

Then turn ON

Many ways to skin a cat in webcore :slight_smile:


#6

Thanks all. I have @WCmore 's version going at the moment and will see how it goes today (should be hot enough). I did modify it a little by saying the temp “rises/drop to or above/below” as the temp actually gets reported with a decimal place.

One question - I am assuming how this gets triggered is the temp sensor should check in with the hub every time the temp changes(?) To verify it is doing this correctly, should turning on the logs for the Pistion show it run the Piston every time the temp changes? I just turned on the logs but was not sure if that is the best place to see this happening in real time.


#7

Actually, if I put the to or in there, then I can’t manually turn it on/off as it will trigger in a larger range (right?)

Let me change it back…


#8

Looks like logs are showing it fire but not every time it changes. I may need to look into the temp sensor and how often it reports back…

Thanks again all!! Really appreciate all the help!!


#9

I often use the Fuel Streams here in webCoRE to check the data that is coming in.

Here is one that does NOT poll for data, but only draws on the graph whenever the ST hub detects a change in the temp:

It is normally safe to assume that most devices will report to the hub when a change is detected.