Getting text in a device

Pop your questions regarding Home automation Domotica hardware here.....
Post Reply
ldborn
Member
Member
Posts: 68
Joined: Fri Jul 11, 2008 12:36 pm
Location: Netherlands

Getting text in a device

Post by ldborn »

I have a smartfone which is running tasker, tasker is getting my location and translates it to an adress. I can post this adress as a text file to my server where homeseer is running. I want to import this text file as a device or stringvalue in a virtual homeseer device. Is this possible? I can't script. Is there anybody who can drop a couple of scripting lines for me?
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: Getting text in a device

Post by AshaiRey »

Did you think of the possibility to use this functionality?
homeseer.com/support/homeseer/WebHelp2/ ... ontrol.htm
Bram
ldborn
Member
Member
Posts: 68
Joined: Fri Jul 11, 2008 12:36 pm
Location: Netherlands

Re: Getting text in a device

Post by ldborn »

Sorry this is not what I mean, I have a text file on my server, in this text file is my adress. I want to import this adress in a virtual homeseer device
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: Getting text in a device

Post by AshaiRey »

First of all.
This is such a simple task with soooo many examples that you should be able to do it yourself.
You know what you want to do and you can google.
Learn a new thing each day is the motto.

Update the device and filepath in this code
Save as a .vb file
Remark: Code not tested but should work as planned.

Code: Select all

Public Sub Main(ByVal Parms As String)
	Const fsoForReading = 1

	Dim Device as String
	Dim strDevice as String
	Dim objFSO as Object
	Dim objFile as Object

	'Your virtual device code
	Device = "<your device code>"

	objFSO = CreateObject("Scripting.FileSystemObject")

	Try
	  objFile = objFSO.OpenTextFile("<full path to your textfile including filename>", fsoForReading )
	  strDevice = objFile.ReadLine

	  hs.setdevicestring(Device, strDevice)

	Catch e as Exception
	  hs.WriteLog("Script error",e.Message)
	End Try

 	objFSO        = Nothing
	objFile       = Nothing
End Sub
Bram
ldborn
Member
Member
Posts: 68
Joined: Fri Jul 11, 2008 12:36 pm
Location: Netherlands

Re: Getting text in a device

Post by ldborn »

This works, thanks man !
Post Reply

Return to “Questions & Discussions Forum”