Home Projects AVR Programming Guides Electrical Fundamentals Insteon Saving Electricity

Recent Updates

EasyGrow Greenhouse
Follow our adventure of assembling an 8x12 EasyGrow Greenhouse.
AVR Programming Guides
We have some nice AVR code samples to share. Lots of AVR goodies like timers, interrupts, and pin I/O for the beginner.
Watts Tables
Use these tables to help you determine how much various items in your house cost you by the day, month, and year.
Saving Electricity
A list of a variety of ways to help you save money by learning how much it costs to run things.
What is a Kilowatt Hour
Saving money on your electric bill starts with understanding what a kilowatt hour is.
How To Measure Watts
Learn a variety of ways to measure watts in your house.
Read Your Power Meter
By reading your power meter you can get a good idea of how much various electrical devices cost you.
Electronics Fundamentals
Learn some basic electronics fundamentals and see if you enjoy the field of electronics.














Set Insteon Timers with Visual Basic 6

Efundies.com - Making Electronics Fun

Make sure you have already followed the instructions to Add Insteon Support to Visual Basic.

Overview

Setting Insteon timers is done using XML. It is not very difficult, but the code can get a little messy. You may want to check out our free application, Insteon Timer Configs, which includes full source code.

First you create an XML string that contains all of the timers that you want to configure. Then you use sm.SendText to send the XML to the PowerLine Controller (PLC). The PLC will chew on the XML for a while. When it is done processing your timers, the PLC will send back to you "saladapp=free" in your sm_OnText callback.

It is a good idea to respond to "saladapp=free" with sm.SendText "listtimers". You will get back a list of the currently set timers which you can parse to verify that they were set.

All of this is illustrated in Insteon Timer Configs if you need furthur help.

Forming Your Timer XML String

A basic Insteon Timer XML string looks like this:

SetTimersXML=<Timers>
<ItemCount>1</ItemCount>
<Timer>
<TID Name="PLCTimer1">PLCTimer1</TID>
<DeviceList>
<Device DID="1" Address="07.B1.12" HouseCode="" UnitCode="" OnLevel="On" DeviceName="LRLamp">LRLamp</Device>
</DeviceList>
<TOD>08:00</TOD><PlusMinusMin>0</PlusMinusMin>
<DOW>SuMTuWThFSa</DOW>
<Security>NOSEC</Security>
</Timer>
</Timers>

If you want to control multiple devices, add them between <Device...> and </Device> tags inside the <DeviceList> section. Keep in mind, there should be NO LINE BREAKS in this string. It should be one long continuous string.

Once you have formed your XML timer string, simply send it to the PLC with the following command:

sm.SendText strXML

Then you can wait for "saladapp=free" in your sm_OnText routine.

If you want a prewritten function that codes your XML string for you, just grab the source to Insteon Timer Configs.

 

Jason Bauer

Written by

Jason Bauer is an owner and programmer for Portforward.com. He's allergic to twitter and facebook, but you can find more of his articles in the Guides section.
 
Saturday, 29-Apr-2017 02:25:18 PDT