VeraLuupNet Integration
Integrate VeraLuupNet to your project using the following steps
-
Add a reference to VeraLuupNet.Framework Project
-
Create a local vera instance of VeraMasterClass providing the following parameters
- a ISessionInterface object implementation
- a Callback for all messages
var vera = new VeraMasterClass(new SessionHolder(), this.VeraMessagesCallBack);
- Obtain the hashed password
Vera authentication requires a specific format of the users password. In order to obtain this, call the FrameworkHelpers.GetHashedPassword static method providing both the username and password of your vera account.
var hashedPassword = FrameworkHelpers.GetHashedPassword(username, password);
- Initialize the vera instance (create session in vera Servers) by using the Initialize method providing the following parameters
- username
- hashedPassword
vera.Initialize(username, hashedPassword);
- Call any luup request by using the LuupRequest method of your vera instance.
vera.LuupRequest("status");
Use this interface to provide an object that stores all needed session variables.
All calls to luup request use stored session variables and do not require re-authentication procedures. (as proposed by Vera Support Team)
You can find an implementation of this interface in the Utils\SessionHolder.cs unit in the main VeraLuupNet project.
Provide a callback in order to receive thorough information on all states of VeraLuupNet. If you do not require any user you can just trace this information using the following example:
private void VeraMessagesCallBack(MessageTypeEnum messageType, string message)
{
var str = string.Format("{0} - {1}", messageType, message);
Trace.WriteLine(str);
}