Premise How to set Date and Time on a 8870

Motorola Premise

kzboray

Member
All,

I am currently using 3 Aprilaire 8870's in my home automation setup and have no problems with how they work with Premise. They are connected via a RS-422 to RS-232 converter which in turn is connected to a UDS-100, that connects to the Premise server over Ethernet.

The thing that is driving my crazy is that the date and time displayed on the 8870's are wrong. Also there is apparently no way to set the date and time from the thermostats themselves. I was hoping someone that has these might have found a way to have Premise update the date and time automatically. Failing that I would settle for a manual way to update the date and time.

Thank you

Kaz
 
Kaz,
Given that the thermostats are accessible via the UDS-100, it should be possible to telnet to them and issue the appropriate command to adjust the clock. What is the "appropriate command"? Good question! There must a link to 8870's programing manual somewhere here on Cocoontech.

ADDENDUM
Kaz, I found the programming manual for the 8870 and it doesn't have a command to set the date and time. Maybe this manual is out of date and someone knows the appropriate command.
 
123,

I think I found the commands.

To set the date:
SN0 DATE=MMDDYY

SN is the attention string for the thermostat, the "0" indicates the command should go to all thermostats on the bus.

To set the time:
SN0 TIME=HHMM

Again I could use some help with the actual code.

The logic I would want is...

1.) Is it a new day (set date / time on the thermostats only once a day)
2.) Send the date / time commands to the UDS-10

I was thinking something like:

1.) Create a custom serial device (8870DT) and link it to the UDS-10
2.) Create a command under the 8870DT called setDate and setTime with TxTextData = SN0 DATE=times.sysDate and SN0 TIME=times.sysTime respectively.

Code:
if sysEvent.newVal = TRUE then
	  if times.sysTime = "12:00:00" then
			devices.customDevices.8870DT.setDate.send = TRUE
			devices.customDevices.8870DT.setTime.send = TRUE
	  end if
end if

I'm sure this won't work as I'm just not that lucky. But this is the basic idea. If you have suggestions I would love to hear them.

Kaz
 
Kaz, why not use a Timer?

The attached image shows a Timer I use in my TaskEx class. DailyTaskController has a half-hour resolution (TimeUnit=Minute and Interval=30) and triggers at 1 minute after midnight as specifed by Filter=* 1 0 * * * (like Unix cron: Seconds Minutes Hours DayOfMonth Months DayOfWeek). When it triggers, the OnChangeTrigger script is executed.

If you've used the Class Wizard to create a new serial device class called 8870DT, you now have a new module that has a Timers container.
  1. Right-click Timers and select: New > Timer
  2. Check the online help to configure the Timer's properties.
  3. Right-click the newly created Timer and select: New > Property Change and then select Trigger.
  4. Enter the appropriate script to update the thermostat.
Based on your example :
devices.customDevices.8870DT.setDate.send = TRUE
devices.customDevices.8870DT.setTime.send = TRUE
I believe you have created two Commands, setDate and setTime, like those shown in the second attached image. TxTextData contains the data to be sent to the thermostat. However, you'll have to update this string, to the current date/time, before sending it. This operation can occur in the OnChangeTrigger script.

IMPORTANT: You've created a class called 8870DT. The first character of the class's name should be alphabetic, never numeric. This rule comes from VBScript's naming conventions. This class name will cause problems when you attempt to write scripts with it. In the attached image, I've renamed it to DT8870.

The OnChangeTrigger script will look something like this:

Code:
' Update the date string to be sent to the the thermostat (SN0 DATE=MMDDYY)
Devices.CustomDevices.DT8870.setDate.TxTextData = _
"SN0 DATE=" & _
gZeroPad(month(now), 2) & _
gZeroPad(day(now), 2) & _
right(year(now), 2)

' Send the string to the thermostat
Devices.CustomDevices.DT8870.setDate.send = true

' Update the time string to be sent to the the thermostat (SN0 TIME=HHMM)
Devices.CustomDevices.DT8870.setTime.TxTextData = _
"SN0 TIME=" & _
gZeroPad(hour(now), 2) & _
gZeroPad(minute(now), 2)

' Send the string to the thermostat
Devices.CustomDevices.DT8870.setTime.send = true

I don't know if you need the ZeroPad function. If "SN0 DATE=MMDDYY" means that Month (MM) must be represented by two digits, you'll have to prepend a zero if the month is less than 10 (i.e. "08" for August and not just "8"). Put the gZeroPad function in GlobalScripts and it'll be accessible to all Modules.

Code:
' Pad a number with leading zeros
function gZeroPad(sNumber, iWidth) 
	gZeroPad = right(string(iWidth, "0") & sNumber, iWidth)
end function


BTW, I'd appreciate it if you could point me in the direction of the updated Aprilaire documentation. My version doesn't mention the DATE and TIME options.
 

Attachments

  • TaskEx_Timer.png
    TaskEx_Timer.png
    18.8 KB · Views: 21
  • DT8870___Commands.png
    DT8870___Commands.png
    12 KB · Views: 20
123,

Thank you, thank you, thank you.

I will study this post in more detail next week and set this up on my system. In response to your question about the updated manual; I found this, and if you look at the second post in the thread you will see a link. This link sent me to a manual that included the date / time functions.

http://board.homeseer.com/showthread.php?p=842311

Kaz
 
Kaz,
Thanks for the link to the AMX manual; it is substantially more detailed than the 3-4 pages I have!

BTW, rather than create a custom "mini-driver" for the 8870, I wonder if it'd be possible to extend the stock driver. Premise makes it easy to create a custom driver but it'd be more elegant if we could simply add new functionality to the existing one.

Everything in Premise is object-oriented and the 8870 driver is just another object. Premise lets you extend any existing class, including the 8870 driver, but I only know how to add new properties, access existing ones, and create new methods.

So what's missing? Well, how do you access existing methods? The Schema tree shows you all objects, and their properties, but it doesn't reveal their methods. Somewhere inside of the 8870 object is a method to push data out the serial port. If it were possible to access this method, we could use it to send the date and time updates. It'd be a more elegant way of adding new functionality because we'd be working with the existing driver rather than creating a new one.

For the moment, creating this custom 8870 driver is the only way I know of to add new functionality.
 
i have been watching this thread with interest as i too have 8870's integrated into my house. i don't use premise, i use m1 and cqc. is there a way to set date and time other than with premise? thanks.
 
...is there a way to set date and time other than with premise? ...
gacevich,

Any software that can establish communications with the thermostat can be used to transmit the date and time command strings (SN0 DATE=MMDDYY and SN0 TIME=HHMM). In theory, Hyperterminal can serve this purpose.

I'm not familiar with CQC's 8870 driver. If it doesn't already support setting the date and time, contact the driver's author and ask to have it included in the next release. Alternately, you can probably write a simple script, along the lines of what Kaz and I have concocted, to periodically update the date and time. However, given that CQC's has an active community of developers, I doubt you'll need to go down this road.

Although an M1 can send text strings to a port, I believe you'll have difficulty creating them with rules. You need the ability to form the current date (MMDDYY) and time (HHMM) strings and I haven't seen this in the M1. I haven't written many M1 rules; perhaps someone more experienced can prove me wrong on this point.

Kaz,
Please let me know if our little workaround actually works. I don't own an 8870 thermostat so I'm unable to do any testing.
 
123,

I'm on the road until the 13th. I did try this on my laptop development server and it worked beautifully. I'll give it a try on the production server when I am back home in a week or so and let you know.

Thanks again.

Kaz
 
123,

I managed to pop home for a day over this last weekend and I am happy to report that the script you put together is working. The only possible hitch is that since the 8870 is attached to COM1, and the custom DT8870 is also attached to COM1, there is a possible conflict. So far it is working fine. I suspect that if the 8870 happens to be polling the COM port or is sending data at the same time the DT8870 tries to send that it may get ignored. But as I said so far so good.

On a similar note I have allowed the temperature of the home to drop to 65 this year trying to save $$. The thermostats themselves report the correct temperature 60-65 degrees at night. But Premise never shows a temperature below 66 degrees. I need to reboot the thermostats themselves to make sure that they aren't actually reporting bad information. But I thought would mention it in case someone else had seen this behavior.

Kaz
 
Your first post led me to believe that Premise was communicating with the thermostats via Ethernet (by way of a UDS-100). I'm surprised both drivers can use the same serial port ... but, if you say it works, it's all good. ;)
 
123,

My bad 123, they do indeed communicate through a UDS-100. When I attached the Network device (UDS-100) to the custom device (DT8870) premise reported a conflict on COM1. It isn't there now, and I suspect it only shows that when the 8870 is communicating with the thermostats or possibly just when the devices is first attached.

Kaz
 
...premise reported a conflict on COM1. ...
I'm not sure why it's complaining about COM1 if you're using a UDS-100. Here's how I'd bind the drivers:
  • In Devices > Lantronix, create two UDS-100 devices, call one "AprilaireInterface" and the other "DT8870Interface".
  • AprilaireInterface and DT8870Interface should have the same IP address and port, namely the address of the physical UDS-100 connected to your network.
  • For Devices > Aprilaire >StatnetController, set its Network property to Devices > Lantronix > AprilaireInterface.
  • For Devices > CustomDevices > DT8870, set its Network property to Devices > Lantronix > DT8870Interface.

EDIT:
FWIW, although I think you should try the above (your mileage may vary) but you should know that it refused to work for me. I get either Port(AlreadyInUse) or Port(OpenFailed). So much for trying to fool the software ...
 
Back
Top