Page 1 of 1

Newbie Question - AppleScript

PostPosted: Tue Feb 23, 2016 5:51 am
by Hank.wheeler
Hi, Sorry for a newbie question ... I am trying a simple applescript to copy a device property value to a variable (named "Watts")


Code: Select all
   set Watts to value of variable "expWattsToday" of device named "EnergyMonitor"


I get the error message:

Can't get value of variable "expWattsToday" of device named "EnergyMonitor"


I know that this property (expWattsToday) exists ... below is from log file

702536144 EnergyMonitor: batteryLevel("0"), expWattsNow("0"), expWattsToday("6049.17"), genWattsNow("0"), genWattsToday("18631.54"),
: lastUpdated("2016/02/23 21:46:41"), networkOwlId("44371910049E"), signalQuality("0"), signalStrength("0"), temperature("25.00"),
: usedWattsNow("0"), usedWattsToday("0"), weatherCode("116"), weatherText("Partly Cloudy"),


... any help will be appreciated.

Re: Newbie Question - AppleScript

PostPosted: Tue Feb 23, 2016 7:33 am
by FlyingDiver
That's a property state, not a property value. But I don't do AppleScript, so I don't know if changing that will fix this.

Any reason you're using AppleScript to do this, rather than a variable action?

Re: Newbie Question - AppleScript

PostPosted: Tue Feb 23, 2016 10:50 am
by jay (support)
I don't know what kind of device you're using, but it seems likely it's a custom plugin device. AppleScript has no access to custom state information so you'll need to use a Python script instead, though I agree with FlyingDiver that using the Insert Device State into Variable action is a much faster and less complicated option.

Re: Newbie Question - AppleScript

PostPosted: Tue Feb 23, 2016 2:32 pm
by Hank.wheeler
thanks guys ... I have definitely over-complicated this :oops: ... I can use the variable actions.