Page 1 of 1
Re Trigger Task?
Posted: Tue May 19, 2009 3:14 pm
by sundodger
Using X10 i somtimes get an error like the one below
"18/May/09","22:30:15","X10","Error","Error reading COM port. Error = Insufficient data in read buffer"
"18/May/09","22:30:15","Property:Power State","Error","Due to an error, Device [Hall Nightlight] Property [Power State] DID NOT change."
what i am trying to do is to use a log file to alpha device to trigger the task again if i get the error.
Have the log file working and can get the data in to the device but where from here.
Is this someone has already done? if so how do you do it.
Thanks Mark...
Re: Re Trigger Task?
Posted: Tue May 19, 2009 4:11 pm
by Osler
What is the exact text you have going into the alpha property?
Osler
Re: Re Trigger Task?
Posted: Tue May 19, 2009 5:42 pm
by sundodger
have housebot generating a daily error log file.
the log file to alpha device is set as follows
CSv Fields 1
Delimiter ,
ID field 5
select on update Last
This puts the info (?) into the log as list section
i now have another problem as the file name changes each day and will show the wrong info.
any ideas?
Re: Re Trigger Task?
Posted: Tue May 19, 2009 9:35 pm
by Osler
I don't know that I have a good solution for you. If this is just an issue with the hall nightlight, why not use a Task such that:
Code: Select all
If SystemTime.Time > 8:00:00 PM AND Hall Nightlight.Power State = Off Then
Hall Nightlight.Power State = On
This should constantly check the time and power state and fix it even if the first attempt isn't successful.
Osler
Re: Re Trigger Task?
Posted: Wed May 20, 2009 7:05 am
by sundodger
It is not just that particular light. but your solution is a far more simple one and i will change my tasks accordingly.
If i can (see next post)
Thanks Mark...
Re: Re Trigger Task?
Posted: Wed May 20, 2009 5:03 pm
by sundodger
tried that as a solution but it is only good to turn the light on. if i have a turn off time or turn the light off via a hardware controller it turns itself back on.
how would you "phrase" the task to allow a particular off time and to maybe cope with the original error for an "off" situation.
Thanks
Re: Re Trigger Task?
Posted: Wed May 20, 2009 5:54 pm
by Osler
Code: Select all
If SystemTime.Time > 8:00:00 PM AND SystemTime.Time < 8:05:00 PM AND Hall Nightlight.Power State = Off Then
Hall Nightlight.Power State = On
ElseIf SystemTime.Time > 12:00:00 AM AND SystemTime.Time < 12:05:00 AM AND Hall Nightlight.Power State = On Then
Hall Nightlight.Power State = Off
This should give you a 5-minute period at the on/off time were HB can keep attempting to set the correct power state for the light. If you have a bunch of lights that you need to do this for it will be easier to do it by having the task run a script. The script will allow nested If/Then statements such that you can have a task set for this:
Code: Select all
If SystemTime.Time > 8:00:00 PM AND SystemTime.Time < 8:05:00 PM Then
Run Script LightsOn.vbs
ElseIf SystemTime.Time > 12:00:00 AM AND SystemTime.Time < 12:05:00 AM Then
Run Script LightsOff.vbs
Where LightsOn.vbs is:
Code: Select all
If GetPropertyValue("Hall Nightlight.Power State") = "Off" Then
Call SetPropertyValue("Hall Nightlight.Power State", "On")
End If
And LightsOff.vbs is:
Code: Select all
If GetPropertyValue("Hall Nightlight.Power State") = "On" Then
Call SetPropertyValue("Hall Nightlight.Power State", "Off")
End If
Simply add an If/Then to the script for each light you want to control. Keep in mind, the script will keep running over and over for the 5-minute period. You may be able to reduce the period to a single minute of script activity.
Osler
Edited script code to add "Call".
Re: Re Trigger Task?
Posted: Wed May 20, 2009 6:00 pm
by sundodger
that looks like it should do it will give it a try tomorrow. it should also cover me overiding the automation via another method as long as i am outside the time period specified.
Thanks Mark...
Re: Re Trigger Task?
Posted: Wed May 20, 2009 6:04 pm
by Osler
See above edit to add script stuff.
Osler
Re: Re Trigger Task?
Posted: Thu May 21, 2009 5:09 pm
by sundodger
tried that as a test on the nightlight before putting it in charge of other tasks but i am getting the folowing error
Line 2 Character 56 Error 0 cannot use parantheses when calling a sub.
on a side note any good places on the net to learn scripting.
Mark...
Re: Re Trigger Task?
Posted: Thu May 21, 2009 10:35 pm
by ScottBot
Code: Select all
SetPropertyValue("Hall Nightlight.Power State", "Off")
should be
Code: Select all
SetPropertyValue "Hall Nightlight.Power State", "Off"
Re: Re Trigger Task?
Posted: Thu May 21, 2009 11:44 pm
by Osler
Sorry. If you are using parentheses you would need to prefix the function call explicitly with "Call". I always make this mistake when writing a script and have to go back and fix it.
Osler
Re: Re Trigger Task?
Posted: Fri May 22, 2009 10:50 am
by sundodger
if it can be broken i will break it. have copied and pasted the script and when it runs i get type mismatch GetPropertyValue
Sorry for being a pain.
Mark...