Jump to content

Created a Windows 10 app for Fibaro Home Center 2 AND 3


Recommended Posts

While working from home for eight months now I had the need to toggle a light or run a scene from my Windows 10 laptop. After some Google I didn't find an app so I decided to learn basic C# and create a Windows tray application myself.

 

The application loads your configured rooms, devices and scenes from your HC2/HC3 and puts them in a menu in the system tray. Now you can run a scene or toggle a light switch without reaching for a wall switch or your phone. 🤪

 

The program looks like this:

 

Image002.png.4945d8e9f4b3ffcec10e57f395b1365e.png

 

I Iearn and get a lot from the Fibaro community, therefore I made the code open source on GitHub.

 

You can download the application from the releases page. You only need the .exe file.

 

I don't own a HC3. If it also works on the HC3 please inform me. Than I add it to the documentation.

Edited by Joep
Added support for HC3
  • Like 2
  • Thanks 4
Link to post
Share on other sites

In my case it doesn't work with HC2 either :-(

Here's the full debug:
 

Zie het einde van dit bericht voor meer informatie over het aanroepen 
van JIT-foutopsporing (Just In Time) in plaats van dit dialoogvenster.

************** Tekst van uitzondering **************
System.ArgumentException: Er is een fout opgetreden tijdens het serialiseren of deserialiseren met de JSON JavaScriptSerializer. De lengte van de tekenreeks overschrijdt de waarde die is ingesteld in de eigenschap maxJsonLength.
Parameternaam: input
   bij System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)
   bij System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)
   bij Fibaro_Control.Form1.<GetFibaroDataAsync>d__5.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij CallSite.Target(Closure , CallSite , Object )
   bij System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0](CallSite site, T0 arg0)
   bij Fibaro_Control.Form1.<BuildMenu>d__6.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)


************** Geladen assembly's **************
mscorlib
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Fibaro Control
    Assembly-versie: 1.0.0.2
    Win32-versie: 1.0.0.2
    CodeBase: file:///T:/Downloads/Fibaro.Control.exe
----------------------------------------
System.Windows.Forms
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.4200.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.4200.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Security
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
----------------------------------------
Microsoft.CSharp
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
----------------------------------------
System.Net.Http
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
System.Web.Extensions
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.4210.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Web.Extensions/v4.0_4.0.0.0__31bf3856ad364e35/System.Web.Extensions.dll
----------------------------------------
System.Dynamic
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
    Assembly-versie: 0.0.0.0
    Win32-versie: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
System.Web
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.4210.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
Accessibility
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Web.Extensions.resources
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Web.Extensions.resources/v4.0_4.0.0.0_nl_31bf3856ad364e35/System.Web.Extensions.resources.dll
----------------------------------------
mscorlib.resources
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_nl_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
System.Windows.Forms.resources
    Assembly-versie: 4.0.0.0
    Win32-versie: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_nl_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** JIT-foutopsporing **************
Als u JIT-foutopsporing wilt inschakelen, moet in het configuratiebestand voor deze
toepassing of computer (machine.config) de waarde
jitDebugging in het gedeelte system.windows.forms zijn ingesteld.
De toepassing moet ook zijn gecompileerd terwijl foutopsporing
was ingeschakeld.

Bijvoorbeeld:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

Wanneer JIT-foutopsporing is ingeschakeld, worden onverwerkte uitzonderingen
naar het JIT-foutopsporingsprogramma gestuurd dat op de computer is geregistreerd
en worden niet door dit dialoogvenster verwerkt.

 

Link to post
Share on other sites
6 minutes ago, Bodyart said:

Hi Joep @Joep,

 

it doesn't work with HC3.

 

afbeelding.png.fc813b9b68436029d2de98cc4a136633.png

 

@Bodyart Thank you for testing! 
To get it working I need some JSON files from the API. 
Please send me a PM with your mail or WhatsApp and I can try to make it HC3 compatible the next couple of days.

3 minutes ago, Bodyart said:

In my case it doesn't work with HC2 either :-(

 

Are the login credentials correct? I need to program more error handling I think. But wrong credentials throw an exception.

  • Like 1
Link to post
Share on other sites

I fixed the error @bodyart got. This was due a large devices API reply. In C# the standard maximum JSON file size for JSON is 4 MB. Fibaro puts its Virtual Device code into the devices JSON reply. For big Fibaro configurations the loaded JSON is sometimes > 10 MB. Unfortunately you cannot filter out real devices only with the API request so I set the max JSON file size to Operating System maximum. With my test JSON I got from @bodyart I got it working on my system, so I released a new version.

 

 

  • Like 2
Link to post
Share on other sites
  • Joep changed the title to Created a Windows 10 app for Fibaro Home Center 2 AND 3

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...