more G-Labs products

Author Topic: Newbie's first questions  (Read 2548 times)

May 20, 2015, 10:19:26 AM
Read 2548 times

ftsikogi

  • *
  • Information
  • Newbie
  • Posts: 7
i am a newbie so please be patient. I have installed HG on an Intel Nuc running Windows 8 the last 2 days and it is running fine until now. I am currently testing the software. I have some questions though that i would like some help

1. I have one fibaro universal sensor (FGB321) with a temperature sensor attached. This is a multichannel device. HG shows the master device and the temperature info. What i cannot figure out is how can I create the other 2 virtual devices that this sensor has (Input1, Input2)

2. I am not aware of C# scrpting language but i would like to do the following. Create a script that will be triggered by a motion sensor and if it is tripped then a snapshot image from my Foscam IP camera will be sent to an email address.

3. Create a simple C# script that turns on a device, wait for some seconds and then turns off

Thank you
Filippos

May 20, 2015, 02:41:08 PM
Reply #1

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
You can look at the C# program Automation and Programs/ZWave/FibaroRGBW module that I wrote for RGBW multiinstance dimmer for handle the virtual modules.
And look at Automation and Programs/ZWave/Multi/Instance Channel Virtual Modules for create the 2 virtual sensor modules you need.

When you activate I1 and I2 do you receive any ZWave messages, In Logging event Console ?

Cheers
Dani

May 20, 2015, 02:52:37 PM
Reply #2

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
For #2, just playing, sent image from an open webcam to text message with:

Code: [Select]
byte[] img = Net.WebService("http://cdn.abclocal.go.com/three/wls/webcam/Loopscape.jpg").GetBytes();
Net.AddAttachment( "", img )
   .SendMessage(  "[email protected]", "", "HG: Motion Detected!" );

This could go into the "Security Alarm System" in the main program loop where the SendMessage already exists.

Not having any luck so far with my camera embedding the username and password into URL:
Code: [Select]
byte[] img = Net.WebService("http://username:[email protected]:8080/shot.jpg").GetBytes();
I use an old android phone with IP Webcam app, the URL with username/password seems to work from chrome browser.
« Last Edit: May 20, 2015, 05:14:22 PM by kevin1 »

May 20, 2015, 04:13:24 PM
Reply #3

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
1. I have one fibaro universal sensor (FGB321) with a temperature sensor attached. This is a multichannel device. HG shows the master device and the temperature info. What i cannot figure out is how can I create the other 2 virtual devices that this sensor has (Input1, Input2)

Did you have in "configure" -> "automation" -> "Z-Wave", the program "Multi Instance/Channel  Virtual Modules" activated ?
2. I am not aware of C# scrpting language but i would like to do the following. Create a script that will be triggered by a motion sensor and if it is tripped then a snapshot image from my Foscam IP camera will be sent to an email address.

mvdarend already create a C# script to arm/disarm a foscam camera :
http://www.homegenie.it/forum/index.php?topic=430.msg2435#msg2435
Perhaps, it can be a good solution, or you can use the code to your target ...
3. Create a simple C# script that turns on a device, wait for some seconds and then turns off

That can be very easy :
  • Trigger code :
    return true;
  • Program code :
    Modules.WithName("xxxxxxxxxx").On();
    Pause(10); // for 10 secondes
    Modules.WithName("xxxxxxxxxx").Off();
    Pause(10); // for 10 secondes

May 20, 2015, 08:07:44 PM
Reply #4

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
To send an email attachment with an image, you can use :

Code: [Select]
var imageData = Net.WebService("url_of_image").GetBytes();
Net.AddAttachment("camera.jpg", imageData).SendMessage("dest_email", "subject", "mail_text");

http://www.homegenie.it/docs/doxy/a00006.html#afdc4d82ab17b6fadc3ad3a2cfa8ed70b
http://www.homegenie.it/docs/doxy/a00006.html#a5da7a367ad63b4ce435a5fd52d11cb75

Cheers,
g.
« Last Edit: May 20, 2015, 08:10:35 PM by Gene »

May 22, 2015, 08:48:11 AM
Reply #5

ftsikogi

  • *
  • Information
  • Newbie
  • Posts: 7
You can look at the C# program Automation and Programs/ZWave/FibaroRGBW module that I wrote for RGBW multiinstance dimmer for handle the virtual modules.
And look at Automation and Programs/ZWave/Multi/Instance Channel Virtual Modules for create the 2 virtual sensor modules you need.

When you activate I1 and I2 do you receive any ZWave messages, In Logging event Console ?

Cheers
Dani

I have both programs "Fibaro RGBW & Multi/Instance Channel Virtual Modules" enabled and when I1 or I2 are activated i do get events in the console. Still though i do not know how to add the 2 virtual devices for I1 & I2.

Thanks

May 22, 2015, 08:55:32 AM
Reply #6

ftsikogi

  • *
  • Information
  • Newbie
  • Posts: 7
Thank you all for your valuable help until now. Just to add that i have managed to send a snapshot image as an attachment from my foscam camera (FI8918W) using the script below:
byte[] img = Net.WebService("http://IPcamera:81/snapshot.cgi?user={username}&pwd={password}&count=0").GetBytes();
Net.AddAttachment( "", img )
   .SendMessage(  "email address", "", "HG: Motion Detected!" );