We have moved at community.getvera.com

Author Topic: Watched Variables  (Read 10196 times)

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #30 on: December 08, 2015, 03:00:51 pm »
Well, yes... I deleted the scene, reloaded the engine. I then added a new scene, new name, saved it and refreshed the page. It's now scene 12 (I assume it fills the open slot) with the new name I gave it and it has inherited the 3 watched variables. So I halted the engine and removed scene 12 all together from the user_data.json file. I started it back up, created a new scene, new name, saved it - refreshed and all is well. I then renamed it back to the old scene name (Front Door), reloaded and it's holding. No issues so far...

Thoughts on why this might be happening. Seems like when I add a watched variable (when I know exactly what I want) things are fine. When I change, add or experiment with the WV for a scene, well - things get strange quickly...

I'm not confident I can recreate the problem so I'll just let the scene sit untouched until amg0 has a look.

Well, that's the point, really.  Who knows what iterations of openLuup / VeraBridge / AltUI you've gone through to generate this situation?  It might not be a real problem at all.

You can always save the user_data.json and restart a system from there.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #31 on: December 08, 2015, 03:11:35 pm »
Probably spoke too soon. I noticed I now have no watched variables for any of my scenes. I'll add them back and see if the issues persist.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline amg0

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: Watched Variables
« Reply #32 on: December 08, 2015, 05:03:20 pm »
V 0.102.1001 fixes a number of things you may want to try.  especially the return ( number / string ) which has nothing to do with your problem,   and some weirdness with add and deleting ( or changing ) a variable watch - which is more likely related to your issues.

let me know.
I also added some more debug statements in ALTUI in debug mode so eventually we can look at Luup logs if pb persists.
thx

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #33 on: December 08, 2015, 07:12:37 pm »
Thank you.. I loaded the latest and will let the two of you know if I run into any issues...

V 0.102.1001 fixes a number of things you may want to try.  especially the return ( number / string ) which has nothing to do with your problem,   and some weirdness with add and deleting ( or changing ) a variable watch - which is more likely related to your issues.

let me know.
I also added some more debug statements in ALTUI in debug mode so eventually we can look at Luup logs if pb persists.
thx
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #34 on: December 13, 2015, 02:04:59 pm »
Need a little direction here... Just trying to accomplish the following two watched tasks:

[1] Door code entered. [sl_UserCode]. Any valid code entered.
[2] Door lock button was pushed. [sl_LockButton]. Only when pushed from exterior.

Vera log data for #1:
Code: [Select]
06      12/13/15 12:16:06.208   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: sl_UserCode was: UserID="3" UserName="Cuda" now: UserID="3" UserName="Cuda" #hooks: 0 upnp: 0 skip: 0 v:0xb3b2c0/DL_USERCODE duplicate:0 <0x2ba58680>

openLuup/AltUI for #1:
Code: [Select]
Schlage [237] urn:micasaverde-com:serviceId:DoorLock1 sl_UserCode (UserID ~= "0")

Vera log data for #2:
Code: [Select]
06      12/13/15 12:04:00.887   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: sl_LockButton was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0xb3c678/DL_LOCK_BUTTON duplicate:0 <0x2ba58680>

openLuup/AltUI for #2:
Code: [Select]
Schlage [237] urn:micasaverde-com:serviceId:DoorLock1 sl_LockButton (new == "1")

Using these, the only log data I ever see is this...
Code: [Select]
06 12/13/15 12:59:22.703 Device_Variable::m_szValue_set device: 10237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: Status was: 1 now: 0 #hooks: 0
06 12/13/15 13:01:19.713 Device_Variable::m_szValue_set device: 10237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: Status was: 0 now: 1 #hooks: 0
« Last Edit: December 13, 2015, 03:11:25 pm by CudaNet »
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #35 on: December 17, 2015, 08:56:48 am »
Hewwo, Jingle Bells... Anyone able to provide input on this, has a lock and can trigger off these variables ?

Need a little direction here... Just trying to accomplish the following two watched tasks:

[1] Door code entered. [sl_UserCode]. Any valid code entered.
[2] Door lock button was pushed. [sl_LockButton]. Only when pushed from exterior.

Vera log data for #1:
Code: [Select]
06      12/13/15 12:16:06.208   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: sl_UserCode was: UserID="3" UserName="Cuda" now: UserID="3" UserName="Cuda" #hooks: 0 upnp: 0 skip: 0 v:0xb3b2c0/DL_USERCODE duplicate:0 <0x2ba58680>

openLuup/AltUI for #1:
Code: [Select]
Schlage [237] urn:micasaverde-com:serviceId:DoorLock1 sl_UserCode (UserID ~= "0")

Vera log data for #2:
Code: [Select]
06      12/13/15 12:04:00.887   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: sl_LockButton was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0xb3c678/DL_LOCK_BUTTON duplicate:0 <0x2ba58680>

openLuup/AltUI for #2:
Code: [Select]
Schlage [237] urn:micasaverde-com:serviceId:DoorLock1 sl_LockButton (new == "1")

Using these, the only log data I ever see is this...
Code: [Select]
06 12/13/15 12:59:22.703 Device_Variable::m_szValue_set device: 10237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: Status was: 1 now: 0 #hooks: 0
06 12/13/15 13:01:19.713 Device_Variable::m_szValue_set device: 10237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: Status was: 0 now: 1 #hooks: 0
openLuup, AltUI, Zway and HomeWave, enough said...

Offline amg0

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: Watched Variables
« Reply #36 on: December 17, 2015, 09:30:31 am »
not sure about others but for me to be able to help you I would need you to follow the following protocol:

a) explain the whole thing you are trying to do from scratch , telling clearly what device id, what watch variable you want and version of ALTUI openluup
b) enable ALTUI device in debug mode
c) give , at this precise point the value of the VariableToWatch value so we verify your watch is properly setup
d) reload Luup
e) exercise the device you want to watch , make sure the old value is different from the new value
f) wait 20sec
g) capture the lua cmh log file and share with us in PM

then we can have a look at the log and see what happens maybe

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #37 on: December 17, 2015, 09:56:15 am »
Thank you, I'll do this tonight when I get home and post all the pertinent data..

not sure about others but for me to be able to help you I would need you to follow the following protocol:

a) explain the whole thing you are trying to do from scratch , telling clearly what device id, what watch variable you want and version of ALTUI openluup
b) enable ALTUI device in debug mode
c) give , at this precise point the value of the VariableToWatch value so we verify your watch is properly setup
d) reload Luup
e) exercise the device you want to watch , make sure the old value is different from the new value
f) wait 20sec
g) capture the lua cmh log file and share with us in PM

then we can have a look at the log and see what happens maybe
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: Watched Variables
« Reply #38 on: December 17, 2015, 12:24:36 pm »
Hewwo, Jingle Bells... Anyone able to provide input on this, has a lock and can trigger off these variables ?

Sorry, completely missed seeing the original post for some reason.

The thing I'd like to see is, as @amg0 mentions, a complete log, so that we can see what variables actually DID change, and then what happened in the variable callback.  There should be tons of diagnostic information in that sequence of events, but it's not just the lock device, or the AltUI plugin actions, it's the way they all play together.

Thanks.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #39 on: December 17, 2015, 01:13:24 pm »
Tis OK, it's a busy week for everyone with the Holidays approaching. I'll pull everything together tonight..

Hewwo, Jingle Bells... Anyone able to provide input on this, has a lock and can trigger off these variables ?

Sorry, completely missed seeing the original post for some reason.

The thing I'd like to see is, as @amg0 mentions, a complete log, so that we can see what variables actually DID change, and then what happened in the variable callback.  There should be tons of diagnostic information in that sequence of events, but it's not just the lock device, or the AltUI plugin actions, it's the way they all play together.

Thanks.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #40 on: December 21, 2015, 11:27:13 am »
Hey all, just a quick update. I'm really trying to not bother anyone with this until I've exhausted all avenues. This is just a matter of a learning curve whereby I need to identify how to isolate the variables for triggering the scene. I can honestly say, I forgot about amg0's log data and therefore I'm focusing on that now (in debug mode). I see some new data and I'm hoping I can adjust and resolve this myself.

Either way, I'll post my results for those who may be in search of the same...
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #41 on: February 02, 2016, 03:23:21 pm »
And it's time to revive this thread, totally my fault for letting this go but like many of us - I got distracted with other things. SO I'm revisiting this.
What's the simplest method of determining a variable for isolation within a Watch.
  • Click on the device variables in their various states (when applicable) ?
  • Evaluate the log data ?
  • Trial and Error ?
  • All of the above ?
I often struggle with this and I don't know why... It seems simple enough in concept but in execution I've failed to reach a level of confidence.  A perfect case is my failed attempts at isolating the user code for my lock. The log below is taken directly from Vera and the variable itself will change based on the user.

Code: [Select]
06      12/13/15 12:16:06.208   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: sl_UserCode was: UserID="3" UserName="Cuda" now: UserID="3" UserName="Cuda" #hooks: 0 upnp: 0 skip: 0 v:0xb3b2c0/DL_USERCODE duplicate:0 <0x2ba58680>

As you can see, the variable is sl_UserCode and the content within that variable is was: UserID="3" UserName="Cuda" now: UserID="3" UserName="Cuda". Now this variable may occur back to back (userA enters, leaves then returns again before userB) or it may change (userA enters then userB enters). So in this real life example, what's the best way to isolate this within a watched variable ? Perhaps I just need to learn by example...
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: Watched Variables
« Reply #42 on: February 02, 2016, 05:40:50 pm »
I think my problem in constructing a solution is that I don't understand what you mean by 'isolate' within this context.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #43 on: February 02, 2016, 05:54:09 pm »
I want to execute a scene using a watched variable, however - I can't seem to get this particular scene to fire (in this case, a lock with various user codes; variable=sl_UserCode).

I think my problem in constructing a solution is that I don't understand what you mean by 'isolate' within this context.
« Last Edit: February 02, 2016, 06:03:21 pm by CudaNet »
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: Watched Variables
« Reply #44 on: February 02, 2016, 10:47:18 pm »
According to this MCV/Wiki page, it documents 2 variables I'm attempting to watch to execute a pair of scenes.
http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions

Code: [Select]
sl_LockButton boolean This is "1" if the Lock button has been pressed on the lock keypad.
sl_UserCode     string Contains information about the last used PIN code: UserID="<pin_slot>" UserName="<pin_code_name>"

I've now entered a PIN code to unlock the door. This event appears for DoorLock1.sl_UserCode within the openLuup logs.

Code: [Select]
2016-02-02 20:51:21.442   luup.variable_set:43: 10237.urn:micasaverde-com:serviceId:DoorLock1.Status was: 1 now: 0 #hooks:0
2016-02-02 20:51:21.442   luup.variable_set:43: 10237.urn:micasaverde-com:serviceId:DoorLock1.sl_UserCode was: UserID="4" UserName="{NameD}" now: UserID="3" UserName="{NameC}" #hooks:0

And an actual Vera.
Code: [Select]
06      02/02/16 21:15:00.480   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: Status was: 1 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0x829808/NONE duplicate:0 <0x2b2a8680>
06      02/02/16 21:15:00.481   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: sl_UserCode was: UserID="3" UserName="{NameC}" now: UserID="3" UserName="{NameC]" #hooks: 0 upnp: 0 skip: 0 v:0xa3ec28/DL_USERCODE duplicate:0 <0x2b2a8680>

Questions:
[1] What expression do I use for DoorLock1.sl_UserCode so I can trigger off any User/UserName entered ?
[2] Why would I never see an DoorLock1.sl_LockButton event ? Vera shows it but no event occurs on openLuup other than this log. :

Code: [Select]
2016-02-02 21:24:13.269   luup_log:0: ALTUI: ALTUI_Handler: parameters is: {"command":"oscommand","oscommand":"tail -n 500 /etc/cmh-ludl/LuaUPnP.log","_":"1454465793867"}
2016-02-02 21:24:13.269   luup_log:0: ALTUI: ALTUI_Handler: outputformat is: null
2016-02-02 21:24:13.269   luup_log:0: ALTUI: debug: hostname=10.0.4.10

2016-02-02 21:24:13.282   openLuup.server:: request completed (94262 bytes, 6 chunks, 14 ms) tcp{client}: 0x2f51038
2016-02-02 21:24:14.328   luup.variable_set:43: 10237.urn:micasaverde-com:serviceId:DoorLock1.Status was: 0 now: 1 #hooks:0
2016-02-02 21:24:14.328   luup.variable_set:43: 10366.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 2252 now: 2250 #hooks:0
2016-02-02 21:24:14.329   luup.variable_set:43: 10506.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 2252 now: 2250 #hooks:0
2016-02-02 21:24:14.845   openLuup.server:: request completed (21457 bytes, 2 chunks, 3336 ms) tcp{client}: 0x2f4e408
2016-02-02 21:24:14.952   openLuup.server:: /data_request?id=lu_status2&output_format=json&DataVersion=469845919&Timeout=60&MinimumDelay=1500&_=1454465793868 tcp{client}: 0x2f4e408
2016-02-02 21:24:18.961   luup_log:3: ALTUI: Clearing...
2016-02-02 21:24:18.961   luup.task:3: status=4 ALTUI : Clearing...
2016-02-02 21:24:20.135   luup.task:4: status=4 Philips Hue by MiOS : Clearing...
2016-02-02 21:24:21.137   luup.task:4: status=4 Philips Hue by MiOS : Clearing...

Vera logs:
Code: [Select]
06      02/02/16 21:24:25.849   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: Status was: 0 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0x829808/NONE duplicate:0 <0x2b2a8680>
06      02/02/16 21:24:25.850   Device_Variable::m_szValue_set device: 237 service: urn:micasaverde-com:serviceId:DoorLock1 variable: sl_LockButton was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0xa3f5a8/DL_LOCK_BUTTON duplicate:0 <0x2b

For this my expression would be (new=='1') for DoorLock1.sl_LockButton  ...
« Last Edit: February 02, 2016, 10:51:14 pm by CudaNet »
openLuup, AltUI, Zway and HomeWave, enough said...