Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to modify the AC tile from the auto template to work with the nest driver?
#1
I am trying to modify the auto generated v2 template for the dummy AC unit to work with the nest driver. I go the overlay page to work. THe place where I am having problems is with the tile.

How would I change the coding so that the up/down arrows will work for the different fields? I changed where the data is displayed, so that part works. But if I cant figure out how to change the arrows. All I was able to do was set it for one field (low set temp, for example), I cant make it dynamic.
Here is how I have it for one field.
Code:
// Ask the variable to move to the prev value
Devices::FieldWrite
    P1=Nest.IncrementTargetLowTemperature_Nest
    P2=1
    P3=True

Devices::FieldRead
    P1=Nest.TargetLowTemperature_Nest
    P2=GVar:ThermoTileVal
    P3=True

// Update the edit value display
ThermoTileVal::SetText
    P1=%(GVar:ThermoTileVal)

// If the new and org values are different, show the set button
If System::Equals
    P1=%(GVar:ThermoTileVal)
    P2=%(GVar:OrgThermoTileVal)
    P3=Case

ThermoSetButton::SetWidgetState
    P1=Hidden

Else
ThermoSetButton::SetWidgetState
    P1=Normal

End

Thanks
Reply
#2
If you look at how the auto-generated content is doing it, it's storing the last selected value and its field in global variables, so it knows what to adjust later when the up/down and set buttons are pressed. So you'd have to do the same.

One way that is often convenient to do these things is to create one or more string variables with enumerated ranges, and put the values you want to cycle through in as the range values. Enumerated variables react to one of the variable target commands (forgetting the exact name) that asks them to move to the next/previous value (with our without wrap around.)

So you can create these variables, let the prev/next buttons just call that previous/next value command on the variables allowing them to wrap. That's an easy way to create those sorts of lists and run through them. I'm not in a position to look right now, but probably that's how I'm doing it in the auto-generated content.
Dean Roddey
Explorans limites defectum
Reply
#3
Thank you. I believe that is how you did it there.
Where do I create the string variables? And while that would work for modes, etc.. how would it work for numbers (temperatures)? It doesnt make sense to add all the possible temperatures as variables.

Thank yo
Reply
#4
That same command will actually also work on a signed or unsigned numeric variable as long as it has a range limit on it.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Admin Interface Help Doesn't Work alexismtz13 1 246 04-28-2022, 01:14 PM
Last Post: Dean Roddey
  Driver for Amazon 4k Stick Darrie 3 508 01-15-2022, 02:21 PM
Last Post: znelbok
  CQSL Interface Driver connects but no control NightLight 3 566 10-26-2021, 01:12 PM
Last Post: NightLight
  SetTimeout and Template gReatAutomation 3 756 03-04-2021, 07:37 PM
Last Post: Dean Roddey
  Template scaling error NishanF 1 902 11-10-2020, 03:21 PM
Last Post: NishanF
  ClickPLC driver now failing after upgrade znelbok 2 992 09-21-2020, 10:48 PM
Last Post: znelbok
  Pentair driver tom 5 1,983 08-02-2020, 11:29 PM
Last Post: kblagron
  Marantz receiver driver (IP) dlmorgan999 6 2,077 05-15-2020, 03:32 PM
Last Post: dlmorgan999
  Variables Driver Client gReatAutomation 4 1,667 04-25-2020, 12:46 PM
Last Post: gReatAutomation
  Reconfig of Driver Causes Built In Triggers to Fire gReatAutomation 2 1,234 03-25-2020, 04:09 PM
Last Post: gReatAutomation

Forum Jump:


Users browsing this thread: 1 Guest(s)