values are changing when using COM control

Having problems? Maybe others have had the same problem too. Post HouseBot technical issues here.
Post Reply
lostdreamer
Member
Posts: 54
Joined: Sat Apr 18, 2009 8:53 pm

values are changing when using COM control

Post by lostdreamer »

Hi Scott,

I'm busy working on a better web interface for housebot then the asp demo, when i came up to a few bugs.

Somehow, and I dont know if it's PHP or the COM object, but it says that the GetPropertyListForDevice method is unknown.
For this I found a workaround by querying the access DB once to get all the devices and their properties.

After the workaround I got a pretty nice working interface, but with 1 big problem:
I have a few devices that have an extra property: LastChange (datetime), when the powerstate property changes, a task fires to change this property to the current datetime.

When I use the GetPropertyValue method to get the value of this property, the property is also changed to the current datetime.
If I then check the history of the value, it says it has been changed by the task that is supposed to fire when the powerstate changes (which it didnt).
The strangest thing is,
The value is "2009-11-03 12:15:34", then I use GetPropertyValue, and the history log will say:
old "2009-11-03 12:15:34"
new "2009-11-04 03:24:17"
Changed by task "doorbell_lastchange"

Then I use the getproperty value method again, now there wont be a new history log entry, but the old one will be changed to
old "2009-11-03 12:15:34"
new "2009-11-04 03:25:28"
Changed by task "doorbell_lastchange"

As if the first change was never there.... and when I check the task in question, it says: Last executed: "2009-11-02 14:35:17"
I disabled the task, and it still did the same.
when I tell the property to log changes to the device / userlog, nothing will be in there, even though the value keeps changing every time I do a getpropertyvalue on it.

As far as I found it is only on all the devices I have with this property, but it's hard to say for sure (since the changes arent being logged anywhere)

Any idea why this is?

Regards,
LostDreamer
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: values are changing when using COM control

Post by ScottBot »

So is the problem only that the history is showing the property changed when it really didn't? Or does the task also execute, or does it just *say* it executed?

I've not heard of a similar problem, but you may have uncovered a new one.

You might want to setup a test to change a completely different property in the same, but simpler (without the task), way. This would remove the task and any other inter-dependencies that may be complicating the issue. Sometimes events bounce around some tangled configurations that lead to unexpected consequences. A simple test case would remove these, and maybe you could export the simple case for me to duplicate.
Scott
lostdreamer
Member
Posts: 54
Joined: Sat Apr 18, 2009 8:53 pm

Re: values are changing when using COM control

Post by lostdreamer »

The problem is that when I get the propertyvalue, it actually changes it to the current date/time (and none of the logs will show this).
Tomorrow I'll try to replicate this problem on a clean install of housebot to see if it is also in there.

If it is, I'll send you an export, if it isn't.... hmm I'll guess I'll start the next test by deleting the properties in question, and putting in new ones again.

I'll let you know tomorrow ;)

Regards,
Lostdreamer
lostdreamer
Member
Posts: 54
Joined: Sat Apr 18, 2009 8:53 pm

Re: values are changing when using COM control

Post by lostdreamer »

Hey Scott,

After a lot more testing, I think I can narrow it down now for you.
The bug is not in the COM, it's in the PropertyValue Substitution in the tasks.

Those devices I was talking about all make use of pvs for setting the LastChange value to %%System Time.Time%%
The thing is, even though it says in the value field something like "Year=2009, Month=11, Day=07, Hour=21, Minute=03, Second=46" it actually is the Time Variable.

Do the following to reproduce :
1) You'll need the following devices
System Time
NULL Device
SleepTimer

2) The NULL Device gets a Time Property which we will call 'LastChange' (name the device test_null for this test)
3) The SleepTimer goes on 1 minute and repeat and running (call it test_timer )
4) Now we create a task with 1 condition and be executed when the condition is met :
if( test_timer.Remaining Time is Equal '00:00' ) Then
Change 'test_null.LastChange' to '%%SystemTime.Time%%'

When we activate this, the NULL_Device.LastChange should increment in steps of 1 minute.

... wait for the task to fire for the first time ...

Now, to spot the bug, open the device in the tree on the left side and select the property LastChange (and remember the Minute / Seconds),
then change view to something else, and back to the property again..... You'll see it has changed to the current time.

When you do the same thing in the history tab of the property, you'll see that the changes won't be shown there (it just rewrites the last log entry with the new value)

The strange thing is, when you select the device itself (so you can see all the properties and there values in a list on the right) you wont see these value changes.
For now, I think I can work around this by letting VBscripts substitute the times instead of directly from the task through pvs but it might be nice to look at in a next version ;)

If you need a import file, let me know and I'll create one.

Regards,
LostDreamer

ps. I also cant seem to get the following methods to work (in both VBscript & PHP) Do you know why this might be?
GetPropertyListForDevice
GetPropertyValueListForProperty
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: values are changing when using COM control

Post by ScottBot »

I was able to duplicate and fix the problem. The problem involved the property value substitution in the Task. A workaround would be to use the system stock values for setting the current time instead of using the substitution.

There is a new, mostly untested, server executable here that you can download, unzip, and copy over the old HouseBotServer.exe file. Please backup the old version before copying the new version in.

The problem with GetPropertyListForDevice and GetPropertyValueListForProperty is that the names are not correctly documented for the COM control. They should be:
GetPropertiesForDevice and GetValuesForProperty
Scott
lostdreamer
Member
Posts: 54
Joined: Sat Apr 18, 2009 8:53 pm

Re: values are changing when using COM control

Post by lostdreamer »

Thats great,

I'll download the executable and test it out and let you know tomorrow how it ran after a day.
Also good news about the getpropertiesfordevice.. This will help me a lot with the web interface.


LostDreamer
lostdreamer
Member
Posts: 54
Joined: Sat Apr 18, 2009 8:53 pm

Re: values are changing when using COM control

Post by lostdreamer »

Hey Scott,

It took a bit longer (had that H1N1 the last 3 days)but after a few days of testing I can say that it works :)
Had no problems with the exe, and the time values are now working as expected.

Thanks :)

LostDreamer
Post Reply