Hi guys,
As it says in the title I would like to build a web based app to control my tellstick but don't know where to start, any help / advice would be much appreciated.
I am currently training to be an MVC web application developer using C# so idealy this would be the technology I would like to use. I am hoping this project will give me a good oppotunity to learn about using API's etc. as well as improving my current home automation system.
Intially my app could be hosted on a PC in my house with my tellstick connected to it and only accessed locally using devices connected to my LAN.
So far I have looked at telldus live as one option .. I really like this idea but having problems setting up oAuth in my application and also have slight concerns about possible lag.
I have also been looking at using the TelldusNETWrapper and tdTool but I am having real trouble getting started with these too.
Any sample scripts or advice to get me going in the right direction would be really appreciated.
Thanks in advance, Chris.
Help I want to build a web based app
Moderator: Telldus
Re: Help I want to build a web based app
Has anyone had any success using C#?
Re: Help I want to build a web based app
Switch King is developed in C#, using Telldus wrapper as foundation.
Martin | http://www.switchking.se
Testa Switch King Pro i din Android/iPhone/iPod: http://www.switchking.se/sv/demo
Testa Switch King Pro i din Android/iPhone/iPod: http://www.switchking.se/sv/demo
Re: Help I want to build a web based app
Wow, switch king is impressive!
Was it the TelldusNETWrapper.dll which you used located in the development folder after installation?
Was it the TelldusNETWrapper.dll which you used located in the development folder after installation?
-
- Site Admin
- Posts: 2243
- Joined: Fri Mar 17, 2023 9:45 am
- Location: Lund
- Contact:
Re: Help I want to build a web based app
You can find the source for the wrapper here:
http://developer.telldus.com/browser/bindings/dotnet
There is also an example how to use it.
http://developer.telldus.com/browser/bindings/dotnet
There is also an example how to use it.
Micke Prag
Software
Telldus Technologies
Software
Telldus Technologies
Re: Help I want to build a web based app
Thanks guys, I have managed to take a step forward however I have hit another problem ...
I have managed to successfully use the following methods to list my devices ..
TelldusNETWrapper.tdGetNumberOfDevices()
TelldusNETWrapper.tdGetDeviceId()
TelldusNETWrapper.tdGetName()
However when I try to use the following methods nothing happens? ..
TelldusNETWrapper.tdTurnOn(deviceID)
TelldusNETWrapper.tdTurnOff(deviceID)
I have debugged through it and can confirm that the method runs and does not throw an exception. The device ID which I am passing into the method is an int and is the expected value which corresponds to the value of my device. I have the same issue with the Basic Turn On device example.
Finally when trying to use the TelldusNETWrapper.tdClose() method I get the following exception ...
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Please can you let me know what I am doing wrong to resolve these issues.
BTW I am using VS2010 and I have tried using .net 4.0, 3.5 and 2.0 ... is this wrapper compatible with my setup?
Many thanks
Chris
I have managed to successfully use the following methods to list my devices ..
TelldusNETWrapper.tdGetNumberOfDevices()
TelldusNETWrapper.tdGetDeviceId()
TelldusNETWrapper.tdGetName()
However when I try to use the following methods nothing happens? ..
TelldusNETWrapper.tdTurnOn(deviceID)
TelldusNETWrapper.tdTurnOff(deviceID)
I have debugged through it and can confirm that the method runs and does not throw an exception. The device ID which I am passing into the method is an int and is the expected value which corresponds to the value of my device. I have the same issue with the Basic Turn On device example.
Finally when trying to use the TelldusNETWrapper.tdClose() method I get the following exception ...
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Please can you let me know what I am doing wrong to resolve these issues.
BTW I am using VS2010 and I have tried using .net 4.0, 3.5 and 2.0 ... is this wrapper compatible with my setup?
Many thanks
Chris
-
- Site Admin
- Posts: 2243
- Joined: Fri Mar 17, 2023 9:45 am
- Location: Lund
- Contact:
Re: Help I want to build a web based app
Code example?
What is returned from TelldusNETWrapper.tdTurnOn(deviceID)?
What is returned from TelldusNETWrapper.tdTurnOn(deviceID)?
Micke Prag
Software
Telldus Technologies
Software
Telldus Technologies
Re: Help I want to build a web based app
Code Sample - Here is my class ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TelldusWrapper;
using Tellstick.Models;
namespace Tellstick.Controllers
{
public class HomeController : Controller
{
int SUPPORTED_METHODS = TelldusNETWrapper.TELLSTICK_TURNON | TelldusNETWrapper.TELLSTICK_TURNOFF | TelldusNETWrapper.TELLSTICK_DIM;
public ActionResult Index()
{
HomeIndexViewModel viewModel = new HomeIndexViewModel() { Devices = new List<Device>(), Error = false };
int numDevices = TelldusNETWrapper.tdGetNumberOfDevices();
if (numDevices < 0)
{
viewModel.Error = true;
viewModel.ReturnMessage = TelldusNETWrapper.tdGetErrorString(numDevices);
}
else
{
for (int i = 0; i < numDevices; i++)
{
int id = TelldusNETWrapper.tdGetDeviceId(i);
string name = TelldusNETWrapper.tdGetName(id);
UpdateStatus(id);
viewModel.Devices.Add(new Device { ID = id, Name = name });
}
}
// TelldusNETWrapper.tdClose();
return View(viewModel);
}
public ActionResult On(int id)
{
var result = TelldusNETWrapper.tdTurnOn(id);
ViewBag.ReturnMessage = TelldusNETWrapper.tdGetErrorString(result);
ViewBag.ReturnValue = result.ToString();
return View();
}
public ActionResult Off(int id)
{
var result = TelldusNETWrapper.tdTurnOff(id);
ViewBag.ReturnMessage = TelldusNETWrapper.tdGetErrorString(result);
ViewBag.ReturnValue = result.ToString();
return View();
}
public void UpdateStatus(int deviceId)
{
int status = TelldusNETWrapper.tdLastSentCommand(deviceId, SUPPORTED_METHODS);
string value = TelldusNETWrapper.tdLastSentValue(deviceId);
}
}
}
The following is returned from TelldusNETWrapper.tdTurnOn(id);
-1 - TellStick not found
.. although it is plugged in and works when I use it through TelldusCentre?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TelldusWrapper;
using Tellstick.Models;
namespace Tellstick.Controllers
{
public class HomeController : Controller
{
int SUPPORTED_METHODS = TelldusNETWrapper.TELLSTICK_TURNON | TelldusNETWrapper.TELLSTICK_TURNOFF | TelldusNETWrapper.TELLSTICK_DIM;
public ActionResult Index()
{
HomeIndexViewModel viewModel = new HomeIndexViewModel() { Devices = new List<Device>(), Error = false };
int numDevices = TelldusNETWrapper.tdGetNumberOfDevices();
if (numDevices < 0)
{
viewModel.Error = true;
viewModel.ReturnMessage = TelldusNETWrapper.tdGetErrorString(numDevices);
}
else
{
for (int i = 0; i < numDevices; i++)
{
int id = TelldusNETWrapper.tdGetDeviceId(i);
string name = TelldusNETWrapper.tdGetName(id);
UpdateStatus(id);
viewModel.Devices.Add(new Device { ID = id, Name = name });
}
}
// TelldusNETWrapper.tdClose();
return View(viewModel);
}
public ActionResult On(int id)
{
var result = TelldusNETWrapper.tdTurnOn(id);
ViewBag.ReturnMessage = TelldusNETWrapper.tdGetErrorString(result);
ViewBag.ReturnValue = result.ToString();
return View();
}
public ActionResult Off(int id)
{
var result = TelldusNETWrapper.tdTurnOff(id);
ViewBag.ReturnMessage = TelldusNETWrapper.tdGetErrorString(result);
ViewBag.ReturnValue = result.ToString();
return View();
}
public void UpdateStatus(int deviceId)
{
int status = TelldusNETWrapper.tdLastSentCommand(deviceId, SUPPORTED_METHODS);
string value = TelldusNETWrapper.tdLastSentValue(deviceId);
}
}
}
The following is returned from TelldusNETWrapper.tdTurnOn(id);
-1 - TellStick not found
.. although it is plugged in and works when I use it through TelldusCentre?
-
- Site Admin
- Posts: 2243
- Joined: Fri Mar 17, 2023 9:45 am
- Location: Lund
- Contact:
Re: Help I want to build a web based app
I suspect you have some version mismatch. Maybe you have some 2.0 version of telldus-core somewhere in your system?
Micke Prag
Software
Telldus Technologies
Software
Telldus Technologies
Re: Help I want to build a web based app
[SOLVED]
Well done! .. your suspisions were correct. The tellduscore.dll in system32 was an old version, an uninstall and reinstall done the trick.
Many thanks for your assistance with this issue.
Well done! .. your suspisions were correct. The tellduscore.dll in system32 was an old version, an uninstall and reinstall done the trick.
Many thanks for your assistance with this issue.