more G-Labs products

Author Topic: Script to trigger Tellstick  (Read 7526 times)

April 18, 2015, 04:27:52 PM
Reply #15

swaner

  • *
  • Information
  • Newbie
  • Posts: 21
Small update here, HomeGenie has now support for loadable interface drivers so I modified my fork to a new repo:
https://github.com/swaner/HomeGenieTelldusInterface.

I had some problems unpacking the zip-files but maybe you are more lucky?::) Anyway, I got it to work by copying the zipped files manually instead.

June 17, 2015, 04:43:55 PM
Reply #16

sintei

  • *
  • Information
  • Newbie
  • Posts: 8
How do you install this on a windows machine?
Cheers

June 17, 2015, 05:17:41 PM
Reply #17

swaner

  • *
  • Information
  • Newbie
  • Posts: 21
You need to install TelldusCenter which can be found at http://www.telldus.se/products/nativesoftware.
Then add your devices in Telldus Center.

Finally you can install Telldus interface driver in HomeGenie:
1. Download the zip file located here: https://github.com/swaner/HomeGenieTelldusInterface/raw/master/Tellstick_0_9.zip.
2. Open HomeGenie and goto Configure->Interfaces.
3. Press Import Interface Driver and locate the file downloaded in step 1

June 18, 2015, 07:31:35 AM
Reply #18

sintei

  • *
  • Information
  • Newbie
  • Posts: 8
Thanks Swaner,

I thought I did precisely this yesterday and nothing happened.
Will revisit this when I get home from work.
Probably just some fault behind my keyboard ;)
Cheers!

June 18, 2015, 10:59:50 AM
Reply #19

swaner

  • *
  • Information
  • Newbie
  • Posts: 21
I thought I did precisely this yesterday and nothing happened.


Yes, I see the problem now. There seems to be a problem reading the zip-package in HomeGenie.
When debugging I get this this error on line 435 in Utility.cs: An item with the same key has already been added.
Stacktrace:
Code: [Select]
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.IO.Packaging.ZipPackage.ContentTypeHelper.ProcessDefaultTagAttributes(XmlTextReader reader)
   at System.IO.Packaging.ZipPackage.ContentTypeHelper.ParseContentTypesFile(ZipFileInfoCollection zipFiles)
   at System.IO.Packaging.ZipPackage.ContentTypeHelper..ctor(ZipArchive zipArchive, IgnoredItemHelper ignoredItemHelper)
   at System.IO.Packaging.ZipPackage..ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
   at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
   at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess)
   at HomeGenie.Service.Utility.UncompressZip(String archiveName, String destinationFolder) in c:\dev\HomeGenie\HomeGenie\Service\Utility.cs:line 435

The exception is thrown inside ZipPackage.cs: http://referencesource.microsoft.com/#WindowsBase/Base/System/IO/Packaging/ZipPackage.cs,1323 .

Maybe someone more experienced in HomeGenie can have a look?

Not sure if this is a bug in HomeGenie or something wrong with the zip-package. You can try to unzip and zip again on your machine (I used 7-zip so maybe try another software?). Otherwise the files can be copied manually.

EDIT: Tried the other packages (WeecoBoard and MqttBroker) and got the exact same error, so there seems to be a generic error: https://github.com/genielabs/HomeGenie/blob/master/BaseFiles/Common/ADDONS.md
« Last Edit: June 18, 2015, 11:04:46 AM by swaner »

June 18, 2015, 11:59:15 AM
Reply #20

swaner

  • *
  • Information
  • Newbie
  • Posts: 21
Update, I managed to get this to work by using another zip-utility. What do you think about using this tool instead Gene?

Replacement of existing method on line 431 inside HomeGenie\Service\Utility:
Code: [Select]
internal static List<string> UncompressZip(string archiveName, string destinationFolder)
        {
            List<string> extractedFiles = new List<string>();

            // Unarchive (unzip)
            System.IO.Compression.ZipFile.ExtractToDirectory(archiveName, destinationFolder);
            extractedFiles.AddRange(Directory.GetFiles(destinationFolder));

            return extractedFiles;
        }

In order to use this a reference to assembly System.IO.Compression.FileSystem (included in the .net framework) is needed.
« Last Edit: June 18, 2015, 12:03:46 PM by swaner »

June 18, 2015, 01:24:52 PM
Reply #21

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hello guys,

I think the problem is related to a bug in the runtime.
A work-around is to modify ContentTypes.xml file in the ZIP archive:

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
    <Default Extension="so" ContentType="" />
    <Default Extension="dll" ContentType="" />
    <Default Extension="xml" ContentType="" />
    <Default Extension="TXT" ContentType="" />
    <Default Extension="txt" ContentType="" />  <<<------ remove this
    <Default Extension="html" ContentType="" />
    <Default Extension="png" ContentType="" />
    <Default Extension="mdb" ContentType="" />
</Types>
remove the entry:
Code: [Select]
<Default Extension="txt" ContentType="" />
and replace the xml file in the archive.

Cheers,
g.

June 18, 2015, 01:46:24 PM
Reply #22

swaner

  • *
  • Information
  • Newbie
  • Posts: 21
Great finding! Now it works :). Noticed that the other add-ons also has the same file (MqttBroker and WeecoBoard).

sintei: I have updated the zip-file on github. So please try again https://github.com/swaner/HomeGenieTelldusInterface/raw/master/Tellstick_0_9.zip

June 18, 2015, 08:40:14 PM
Reply #23

sintei

  • *
  • Information
  • Newbie
  • Posts: 8
The plugin loaded fine.
But then restarted HG over and over again.
I could see the problem was when a Temperature/Hydrometer was sending signals.
It triggered a status install thingie and restarted HG.
Every time it was sensed HG restarted.
Sensors can't be erased, only "non visible" in telldus because they send data all the time.

Also, I am having other problems: Dimmer will let me turn on or dim, but only once.
It will not let me turn off. Or dim another percentage.
If I turn off the light manually I can see that I can start the light from HG again, so this is weird.

And another "switch" works OK. Only thing not working is the "toggle"-button in the widget, which really is just cosmetics for me as I will not use it.