My experiences developing a native App with C#, Xamarin, MvvmCross and Visual Studio 2017 for Windows.

Introduction

I have over 35 years of experience in programming on environments varying from mainframe, midrange, small systems to PC’s but never have I met so many problems in one development process.

The past 6 months I’ve been developing just 1 app for Android and iOS and it has been an experience that gives me mixed feelings about mobile development. Don’t get me wrong I just love programming in general but this… this was different.

The app

This is what the app is supposed to do:

  • Register the device with UserId and Password via a webservice.
  • Enter a TAN once for the registration and verify it via a webservice. This authenticates the device with the server just once.
  • Add an Application (website) one wishes to verify. There are 5 websites notifications can be received for.
  • Accept push notifications from the server via Firebase when a user wishes to authenticate for a website.
  • When a notification is received:
    • When received from a webbrowser on a PC start a QR code scanner and scan the code that is shown on the webpage. When the information in the QR code equals the information in the notification accept the verification.
    • When received from a mobile device show buttons ‘Accept’ and ‘Cancel’.
      • When ‘Accept’ is clicked tell the server the authentication is accepted via a webservice.
      • When ‘Cancel’ is clicked tell the server the authentication is not accepted via a webservice.
  • The user must be able to add more websites to the registration.
  • The user must be able to remove websites from the registration.

Development choices

It was decided that the app would be built with MvvmCross with native code and not Xamarin.Forms A consultant from a external softwarehouse told us that as long as you stay with the controls provided you’re ok but when you need something extra you would have to write your own renderers which is a pain. And of course he knew MvvmCross very well. For the record, I had more experience with XAML at that time and favoured Forms. Also bad experiences with third party UI controls had influence on the decisions made.

It was also decided we would use PCL for the Core functionality. I would have liked to go with .Net Standard but that was not covering all needed functionality at that time.

MvvmCross forces you into the MVVM pattern which is a good thing. You have to think about reusability of code all the time and separate generic functionality and device specific code as much as possible.

Learning curve

Learning MvvmCross was a first. It’s a good concept and overall works pretty smooth. The MVVM pattern was not new to me which gave me a headstart. The difficulty with PCL in combination with native code is the  communication between the libraries. You can access PCL from native but not (easily) from PCL to native. MvvmCross bridges that gap easily using Inversion of Control (as Forms would have done). With the help of the consultant MvvmCross was learned quickly. It does however have some perks. Because of late binding the linker sometimes does not know that you’re using certain functionality and does not add it to the endresult which leads to confusing situations. But once you get the hang of it you’ll recognize these situations pretty fast. A pitfall is debug and release mode. In debug mode the linker adds everything all the time but it does not do so in release mode causing the app not to work correctly in it’s final release.

Practice

Because Xamarin is under constant development you’re on the bleeding edge and because you have to conform to two (or more) different platforms you better be prepared to meet frequent crashes and hangs, wrong builds without any clues why, slow performing  builds, frustrating provisioning issues with Apple’s paranoid and absurd complex protection system in combination with wrongly cashed information, differences in layout, OS versions, screensizes of the individual devices you’re building for, etc.

Documentation is sparse, incomplete or deprecated and very often not applicable for your development choices. A lot of the examples come from websites like Stackoverflow but are for a plethora of applicable development choices. You can have examples for Swift, Objective-C and C# for Apple in combination with explanations for Xamarin Studio, XCode, Visual Studio on PC or on Mac. Very often you can deduce from the Swift and Objective-C examples what it should be in C# because luckily the interfaces written very often follow the same name conventions but sometimes it’s not clear or just plain difficult. Without the community development would have been very very difficult if not impossible. Solving everything on your own is very time consuming and sometimes very frustrating.

Using the Xamarin designers needs a lot of getting used to. I really had trouble understanding the constraint system used on iOS devices. I’ve been tearing my hair out why a design was shown correctly in the designer but not on the simulator or device. I finally got the hang of it but It’s been a struggle. The designers are not stable at all. For XAML I was able to grasp the syntax in XML quite quick but the XML of iOS views is hugely complex and I still haven’t got that in my skillset so I rely on the designer heavily. The XML of Android views is quite concise and easy to understand so I hardly ever use that designer. For data binding Android views with MvvmCross you have to edit the axml by hand (at least I’ve not found a way via the designer yet).

Bugs, bugs, bugs

Sometimes development progress comes to a grinding halt when again some kind of problem with the development environment crops up. I’ve had hangs during solution loads, during debugging and deployment. Sometimes deployment becomes impossible and you’re stuck being unable to test your app on a device. One day, because I was using my own Samsung S6, I really had to factory reset my it to be able to deploy to it again and I was forced to completely setup it up again (sigh..). Emulators (or simulators as Apple calls them) are a good solution for straightforward development and deployment to them is pretty fast. But not all functionality a real device can do can be done on an emulator. For instance Firebase is not supported in emulators. It is therefore imperative your final tests are on a device. This also causes difficulty. Who of us has all the variations in devices being used in the world? We use an iPad Pro for iOS and a Motorola G Play for Android testing. It has iOS 10 but we do not have a iOS 9 device. Some code is specific for these devices (Firebase) so how do we test that? Xamarin offers a service with lot’s of devices but that is pretty expensive to use.

You can be faced with the situation that the day before everything was working perfectly and the next day (after a fresh boot) everything seems broken. Builds just aren’t stable at the moment. Sometimes you end up with the situation having to clean up and rebuild your solution. Sometimes even that does not help and you have to manually remove all ‘obj’ and ‘bin’ directories just to get going again. In my experience changing something in PCL will cause wrong builds so you better be cleaning and rebuilding when changing something in PCL. And it takes a lot of time.

Testing

Turnaround times are just plain bad. Every build and deployment using a fast computer with a SSD and lot’s of memory still takes at least up to three minutes for a complete build(depending on the size of your solution of course) meaning that the a small change can take a relatively long time before it can be tested. For iOS development you have to have a Mac. We use a 2012 refurbished Macbook and it is pretty fast. All communication goes through a network connection and the Mac only has a 100Mbit port. Even designing a view in the Xamarin designer causes a generation process to start on the Mac. Although this is a bottleneck builds on a Mac are faster than the local builds for Android. Deploying to a real device is slower than deploying to an emulator for both iOS and Android. Frustrating is the fact that when you loose connection to the Mac everything just stops working. I very often loose connection and reconnect does not always work. You’ll have to restart Visual Studio to be able to reconnect.

Debugging

Debugging is pretty good. There are limitations however. You can not edit and continue and you can not change the position of the current execution point. Because you’re testing against native code you’ll very often see that you’re in external code rather than in your own code when an exception occurs but that is not uncommon in other development too. The logs on the devices help a lot during debugging. You will have to filter out logging for your app because when you run on a device with a lot of installed apps logs can become very bulky. Stacktraces are very often native too (Java on Android and Objective-C on iOS). You’ll have to learn how to interpret these but most of the time it is pretty clear although I’ve seen some pretty confusing errors being thrown that put you off track. To quote a very famous Britisch detective: “If you can’t find the solution in the explainable investigate the unexplained.”.

Conclusion

Mobile development with Xamarin is time consuming and thus expensive. The platform, although it has been around quite a long time, is not stable. Because of the many different Development environments, Platforms and Programming possibilities the amount of knowledge and skills needed is huge making the learning curve pretty steep. Documentation is sparse, incomplete and often deprecated. The community is huge and very active. Before deciding about Development environment and architecture (Forms or Native, MvvmCross, PCL or .Net Standard) one should investigate the (im)possibilities very thorough. Once you have made you choices and head on with development it is hard to change.

IP address has been blocked by SSH

Yesterday my Synology reported me that an attempt had been made to get into the Terminal (SSH) and I was shocked. How did they get on my network in the first place. I started investigating the issue.

image

At first I thought I was really hacked but this was not the case. Synology uses 2 modern features here:

  1. UPnP – which is the Plug and Play for your local network
  2. Automatic blocking

UPnP

UPnP (Universal Plug and Play) is a protocol that allows devices on your network to automatically connect to other devices. A good example of the use of UPnP is for instance DLNA (Digital Living Network Alliance). DLNA allows for streaming video, music, photo’s, etc. on your network.

Automatic blocking

Automatich blocking is a feature that secures your Synology NAS automatically. Take a look at Configuration –> Security –> Automatic blocking.

KPN router

We have a subscription with KPN in the Netherlands. In our home the KPN router is installed (KPN Experience H368N). I think I enabled the UPnP IGD myself but it is possible that it was enabled by default.

image

The Synlogy NAS has UPnP activated by default.

With both devices having UPnP enabled they can talk to each other. The Synology will say to the router: “Hey I would like to open port X to the outside world and map it to my internal port Y”. The router will answer: “Ok, no problem, done”.

The result of this is that several ports of the Synology are opened automatically to the internet. From that moment on the router will send any input for port 443 to the Synology NAS. Below is a list of ports automatically opened in the router by several UPnP devices in my network.

image

One of the ports being exposed is port 443 which is the SSH port on my Synology. Any hacker on the net will find my IP address and scan for obvious ports like 443 and try to log in with obvious userids and passwords.

So in short: There was nothing hacked in my system. My network was not invaded by anyone. Automatic blocking of the Synology simply blocked the attacker for several hours after 10 attempts (I’ve lowered that to 3 attempts just for now but plan to disable SSH all together in the near future). And that’s what was reported in the first place (‘IP address <nbr> of <internal device name> has been blocked by SSH’). I can sleep peacefully again Glimlach

DataObjects.Net code T4 generation

DataObjects.Net is a very versatile Object Relational Mapper (ORM). What an ORM does is solve the relation object-oriented clash we developers always have when we program in OO languages like C#, Java, C++, etc in combination with a Relational Database like f.i. Microsoft SQL Server. After careful deliberation we decided to use DataObjects.Net (DO) as our ORM.

We also wanted to use T4 Code Generation for our ViewModel and extension of the Data Model. Now DO does not support T4 out of the box. In a previous project we wrote a library that uses reflection to dissect the compiled Assembly produced by the compiler in combination with Postsharp (used by DO to inject code).

Now in DO, which is primarily a ‘code first’ tool, you define your Data Model in code using Attribute classes. Here’s an example.

using Xtensive.Orm;

namespace T4DB.Entities
{
    [HierarchyRoot, KeyGenerator(Name = "Root")]
    [TableMapping("Root")]
    public class RootEntity : Entity
    {
        [Key]
        [Field(Nullable = false)]
        public int Id { get; private set; }
    }
}

using Xtensive.Orm;

namespace T4DB.Entities
{
    [TableMapping("Person")]
    public class PersonEntity : RootEntity
    {
        [Field(Nullable = false)]
        public string FirstName { get; set; }

        [Field(Nullable = false)]
        public string LastName { get; set; }

        [Field(Nullable = false)]
        public string Prefix { get; set; }
    }
}

As you can see we use a RootEntity that is inherited by, in this case, the PersonEntity. We use this construct thoughout the DataModel. What this causes is that each entity has its own unique key throughout all the data (no row in a table has the same key). This is a unique feature of DO and gives us the ability to find entities just by its key. DO takes care of the resolution into the right type for us. Ok so far this little side-step.

After compiling the above Data Model you get an Assembly. An Assembly is a written into a DLL stored on disk. In the case above the name will be ‘My.Model.dll’.

What is present in this Assembly we are able to dissect using reflection. Now we could reflect all the information we need in T4 but that would clutter the templates so we decided to build a second Assembly that is going to gather all the needed information for code generation.

Here’s an example showing the loading of the Data Model Assembly into a Metadata instance in a T4 template.

<#@ output extension=".cs" #>
<#@ Include file="$(SolutionDir)Common.T4\Assemblies.ttinclude" #><#   
    IServiceProvider hostServiceProvider = (IServiceProvider)Host;

    string directoryPath = Host.ResolvePath(@"..\..\My.Model");
    string configName = dte.Solution.SolutionBuild.ActiveConfiguration.Name;
    string assemblyName = directoryPath + @"\bin\Debug\My.Model.dll";

    Assembly assembly = Assembly.LoadFrom(assemblyName);
    Metadata.MetadataContainer.AddAssembly(assembly);
#>

Now of cource we need the Metadata class. Here is the part of that class that loads the assembly from disk into the MetadataContainer using the AddAssembly() method.

using System;
using System.Linq;
using System.Collections.Generic;
using Xtensive.Orm;
using System.Reflection;
using System.Windows.Forms;

namespace My.Metadata
{
    /// <summary>
    /// Metadata container class.
    /// </summary>
    public class Metadata
    {
        private static Metadata m_MetadataContainer;

        /// <summary>
        /// Singleton for obtaining a MetadataContainer object
        /// </summary>
        public static Metadata MetadataContainer
        {
            get
            {
                if (m_MetadataContainer == null)
                {
                    m_MetadataContainer = new Metadata();
                }

                return m_MetadataContainer;
            }
        }
        
        /// <summary>
        /// Add all DO.Net Entity types of an Assembly
        /// </summary>
        public void AddAssembly(Assembly assembly)
        {
            try
            {
                foreach (var entity in assembly.GetTypes())
                {
                    AddEntity(entity);
                }
            }
            catch (ReflectionTypeLoadException lex)
            {
                int hr = System.Runtime.InteropServices.Marshal.GetHRForException(lex);
                MessageBox.Show(lex.LoaderExceptions[0].Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private List<EntityMetadata> m_Entities;

        /// <summary>
        /// List of Entities in the metadata collection.
        /// </summary>
        public List<EntityMetadata> Entities
        {
            get
            {
                if (m_Entities == null)
                {
                    m_Entities = new List<EntityMetadata>();
                }

                return m_Entities;
            }
        }

        /// <summary>
        /// Add en entity type to the container.
        /// </summary>
        private void AddEntity(Type entity)
        {
            if (!ContainsEntity(entity))
            {
                if (entity.IsSubclassOf(typeof(Entity)))
                {
                    Entities.Add(new EntityMetadata(entity));
                }
            }
        }

        /// <summary>
        /// Is the type already present in the container?
        /// </summary>
        private bool ContainsEntity(Type type)
        {
            foreach (EntityMetadata entityWrapper in Entities)
            {
                if (entityWrapper.Type == type)
                {
                    return true;
                }
            }

            return false;
        }
    }
}

Note: This class may not compile correctly because I combined several snippets from the original code. You can find the complete Metadata class in the attached zip file.

In the AddAssembly() you can see we add all DO entities (the AddEntity adds type Entity only) using the EntityMetadata class.

After loading the Assembly in the Metadata object we have all the DataObject Entities in a collection. Now each of the above mentioned EntityMetadata collects all the member information from the Entity. So after loading the Assembly we have an Entities collection and per Entity a Properties collection through which we can iterate in our template. Below is the MyFirstTemplate.tt taken from the attached zip file.

<#@ output extension=".txt" #>
<#@ Include file="$(SolutionDir)T4Includes\Assemblies.ttinclude" #><#   
    try
    {    // START main try
        // Initialization Output Manager
        Manager outputManager = Manager.Create(Host, GenerationEnvironment);

        // Start Costruction CodeModelTree
        IServiceProvider hostServiceProvider = (IServiceProvider)Host;
        DTE2 dte = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.11.0");

        string directoryPath = Host.ResolvePath(@"..\My.Model");
        string assemblyName = directoryPath + @"\bin\Debug\My.Model.dll";
        Assembly assembly = Assembly.LoadFrom(assemblyName);
        Metadata.MetadataContainer.AddAssembly(assembly);
#>
// Empty file
<#
        try
        {
            foreach (EntityMetadata entity in Metadata.MetadataContainer.Entities)
            {
                if(entity != null)
                {
                    outputManager.StartNewFile(entity.VMName + ".generated.cs");

#>
using System;

namespace MyNamespace
{
    public partial class <#= entity.Name #>
    {
        public <#= entity.Name #>()
        {
        }
<#
                    foreach (var property in entity.Properties)
                    {
#>
        public <#= property.FieldTypeString #> <#= property.Name #> { get; set; }
<#
                    }
                }
#>
    }
}
<#
            }
        }
        catch (Exception ex)
        {
#>
            // ERROR <#= ex.Message #> 
            // STACK <#= ex.StackTrace #>
<#
        }

        outputManager.Process(true); //write files to disk

    } // END main try
    catch(Exception ex)
    {
        MessageBox.Show("Error in MyFirstTemplate.tt: " + Environment.NewLine + Environment.NewLine + ex.ToString(),"Error in Transformation");
    }
#>
<#+  
#>

After saving this file to disk the template generator will start loading the template and saves the generated output to disk and adds it to the project as subitems from the template.

image

In for instance the VMPersonEntity.generated.cs the following is generated with this template.

using System;

namespace MyNamespace
{
    public partial class PersonEntity
    {
        public PersonEntity()
        {
        }
        public String FirstName { get; set; }
        public String LastName { get; set; }
        public String Prefix { get; set; }
    }
}

Solution: T4.zip

PS: In order to be able to compile this solution you will need to add the DataObjects.Net Nuget package via the Nuget Package Manager.

image

Type ‘Dataobjects’ in the searchbox in the upper right corner and wait for the result.

Click the ‘Install’ button.

image

Select the following projects for installation.

image

After that start the compilation. It is possible the version of DO and PostSharp is different in your new installation. In that case you will have to change the version info in the ‘Assemblies.ttinclude’ file in the T4Include project.

Also remove the RequiresPostSharp.cs files where not needed. That file is only needed in the T4Database project.

Poor man’s weather station

With all the money invested in our Loxone home automation project there currently is no room for a weather station. I need one to steer the heating system. The KNX OT Box of Theben I bought has a program which can take outdoor temperatures into account.

Currently Loxone has a weather service but it is limited to certain countries and the Netherlands is not included (yet). So I started thinking, can I not use weather services on the internet to tell me my local temperature, mold that into a PicoC program and have the service tell my heating the outdoor temperature?

The answer is “Yes you can!”. I’ve cooked up a little PicoC program which will do exactly that. Here’s how to do that:

A WARNING IS IN PLACE HERE! PicoC is not very strict in its syntax checking. A missing curly bracket will still run but gives unpredictable behavior. At one time I had to remove the SD card from the server, format it and reinsert it because my server did not respond to anything anymore. Be careful with what you program and check double check your code before committing it to the server!

You will need an account at a weather service. I used ‘aerisapi.com’. Go to their website and create an account. After you have created your account, register your application and you will get a UserID and UserSecret which will you will need in the code below.

Add a ‘Program’ module to a page in your Loxone Config program.

Loxone Config

Loxone Config

 

I use a lot of Memory flags which help me organize the programming. Here are the settings for the outdoor temperature memory flag. Uncheck the ‘Use as digital flag’. Now you can also change the ‘Unit’ value to reflect the value.

image

Doubleclick the module and paste the program below into the edit window and change the values of <your id> and <your secret> to the values obtained from the website mentioned above.

 

// This programm calls the aerisapi.com weather web service.
// The return value is a JSON string. Since PicoC does not support
// JSON I use scraping of the string to find the values.

enum OutputPorts
{
    Temperature,        // AQ1
    Humidity,            // AQ2
    windKPH             // AQ3
};

int GetIntValue(char *name, int def)
{
    int value = def;

    int pos = strfind(result, name, 0);

    if(pos > 0)
    {
        char *stemp = calloc(1, 10);
        int lenName = strlen(name);

        strncpy(stemp, result + pos + lenName, 5);

        value = atoi(stemp);

        setoutput(Temperature, temp);

        free(stemp);
        stemp = 0;
    }

    printf ("%s = %d", name, value);

    return value;
}

/// <Summary>
/// Main loop.
/// </Summary>
while(TRUE)
{
    char *host = "api.aerisapi.com";
    char *page = "/observations/apeldoorn,nl?client_id=<your id>&client_secret=<your secret>";

    char *result = httpget(host, page);

    if(result != 0)
    {
        int temp = GetIntValue("\"tempC\":", -100);

        if(temp != -100)
        {
            setoutput(Temperature, temp);
        }

        int humidity = GetIntValue("\"humidity\":", -100);

        if(temp != -100)
        {
            setoutput(Humidity, humidity);
        }

        int wind = GetIntValue("\"windKPH\":", -100);

        if(temp != -100)
        {
            setoutput(windKPH, wind);
        }

        free(result);
    }

    // Slow the loop down 10 minutes
    int sleepTime = 10 * 60 * 1000;
    sleep(sleepTime);
}

When you run the code in the server you will see the following in the Log. And the memory flags will show Temperature Celsius, Humidity and Wind velocity.

SNAGHTML8818c0

MCRemote tips & tricks

I often get questions about connection problems when using MCRemote. The rule of thumb is that MCRemote can not read what it can not receive.

Most of the problems are related to the local network. Check the following:

Switch off authentication in MC

A known problem is when Authentication for the Library in MC is switched on. If you do not really need it switch it off for now (I’m working on a solution for the problem).

Authentication

Did you enable the webservice in MC?

Before MC Remote can connect to MC the web service must be started. In MC do the following:

Go to the ‘Media Network’ plugin click the options button. Check that the ‘Use Media Network to share this library and enable DLNA’ is enabled. After confirmation of the settings you should see some activity going on in the ‘Activity log’. As soon as MC Remote is started there should be a lot of activity going on here. To filter out all other connections you can select the server in the ‘Server summary drop down box’.

image

Can I connect to the server MC is running on?

Try and enter the following url in the browser of your phone:

http://<IpAddressOfTheServer>:52199/MCWS/V1/

image

What you see here is a description of the web service MCRemote is relying on. Tapping the different links in the page should give you control over MC (Pause, Play, Next, Previous, etc).

If you can not connect to the service and you don’t see the page above then there is something blocking the connection to the server. There are many reasons why the connection fails and possibly more than one at the same time, so if one suggestions does not help move on to the next leaving the previous suggestion active too:

  • The firewall on the server is blocking port 52199. Try and disable the firewall temporarily to eliminate this cause during testing. Afterwards you can add a rule to the firewall allowing the connection.
  • Virus scanner or Adware on the server is blocking the connection. Try and disable the anti virus and adware software temporarily to eliminate this cause. Look in the description of the software how to allow connection for the port (default 52199).
  • Many routers have restrictions on wireless connections as a means for protecting your local network. These restrictions could block the remote. Possible restrictions are:
    • Network access list which only allows certain MAC Addresses to connect. In that case disable the list temporarily to eliminate the cause during testing. If this is the cause, add the MAC Address of the phone to the list.
    • Blocking of ports other than the standard ones. For instance, most routers allow port 80 which is the standard for Http traffic. All non standard ports are refused. You can use port forwarding or enabling of the default port 52199 of the MC service. In case you choose for port forwarding you should give your phone a fixed IP Address. When you rely on DHCP it is possible the router returns a different IP Address each time the phone connects to the wireless network.
  • Network congestion could be a cause. When you have a lot going on at your local network (many DLNA devices, Bit Torrent downloaders, Skype, VoIP, etc.) it can be that the network is congested meaning that there is not enough bandwidth left for other tasks.
    • Try and disable as many network activity as possible during testing. Stop bit torrent software completely. Disable bit torrents in NAS equipment during testing. Bit torrents also take a lot of upload bandwidth even when no download is in progress.
    • Many routers have a so called QoS (Quality of Service) setting page where you can give certain activities more/less bandwidth to prevent other tasks from getting to little. MC’s traffic will probably be in the ‘Other connections’ since port 52199 is not a standard port.

How do I find the IP Address of the server?

Start a ‘Command box’.

Type (Windows button)+’R’. The ‘Run’ dialog should appear. Type ‘cmd’ and click the Ok button.

SNAGHTML10495af

type ‘ipconfig /all’ (without the single quotes) and press the ‘Enter’ key on your keyboard.

image

The IP Address will be listed for your network connection.

Alternatively in Windows 7 you can also get the IP Address using the Control Panel like below (your network connection will probably have another name then ‘Local Area Connection 2’.

SNAGHTML10c5037

Domotica

In October of this year (2010) we bought a house in Apeldoorn (the Netherlands). The idea in my head is to make this the most energy efficient house possible. Home automation is one of the essential things to achieve that. My investigations lead to many solutions. Once upon a time I did some X10 so started looking there. The Home Automation world goes fast. New protocols like KNX, ZigBee and Z-Wave passed by. Then my eye caught the Loxone system. It is a KNX based system but has many Extensions (DMX, EnOcean, RS232, RS485, 1-Wire) which makes it the most compatible system I could find. The EnOcean extension is very interesting. I’ve read a lot about it and got convinced that is the way to go. EnOcean is a wireless and battery less standard for Home Automation that is big business in Germany, Austria and Switzerland. In the Netherlands it is not so popular but that goes for Home Automation in general here. Big energy-neutral buildings have been equipped with EnOcean already. The combination of KNX and EnOcean makes it a very powerful solution.

In my youth I learned how to build electrical installations at School. EnOcean has a huge impact. Traditionally wiring was needed to all switches and power outlets. With EnOcean the wiring to switches becomes obsolete which means less cost during the building process and less magnetic fields in the home. One can even glue a switch to the wall. Many manufacturer deliver their switches with double-sided tape. Each outlet for light has to start and end in the distribution box which is normally not done. For existing houses this is hard if not impossible to fit later on. The advice to have empty pipes to each corner of your house needs to be revisited. They are still needed but can be a lot less with EnOcean.

If you only use the KNX wired switches you will also need piping to each switch in the home ending in the distribution box too.

The nice thing about EnOcean materials is that they are battery less too. They have developed a technology they call ‘Energy harvesting’. The energy efficient transmitters en receivers get the needed energy from their environment. Until now 3 harvesting methods have been developed.

1. Kinetic energy which is produced when you press a button.
2. Solar energy.
3. A new one is energy from temperature differences.

At the moment I am writing this article there are not yet servo controllers for radiators without batteries but my guess is that it is a matter of time.

A disadvantage of EnOcean at the moment is that it is relatively expensive in comparison to materials for other techniques. You will need to take the omission of piping and wiring into account to calculate the total cost. In our new House an extra empty pipe would cost me 45 Euros. An EnOcean switch of Eltako costs 40 Euros. For the power outlets you will still need piping and wiring.

For a long time Z-Wave was my favorite but reading about it in many blogs gave me the impression this was a failing standard. I read about lots of problems and that was something I really did not want. So I dropped Z-Wave as an alternative.

Loxone, default, supports my Sonos and several other streaming devices (Squeezebox, etc.). So less remote control head age.

06-05-2012 Bought Loxone.

Well the delivery of our home is nearing and I had to decide. Last Friday I ordered the Loxone System. It will be here in a few days (from Austria).

What I ordered is:

  • Miniserver
  • Extension module
  • Dimmer extension module
  • EnOcean extension module
  • 8 Servo controllers 0 – 10 volt
  • M30 adapters for the Servo controller on the Floor heating and Radiators (Hope they fit).
  • 3.8 A 24V Power supply

A total of 2300 Euro. That is a lot of money and I’m not finished yet.

Because Home Automation is not big in the Netherlands, finding a company that has EnOcean materials is hard. I found a company in Deventer Klusspullen.nl. They have the following brands

I mailed the Eltako dealer in the Netherlands a mail. He promptly reacted with the question “Can we test this?”. I am curious to what his intentions are. The list below is what I need specifically for our home.

Floor Location # Price Total Brand Type Extra Description
Ground floor Hallway 1 € 47,50 € 47,50 Eltako FT55 Double Switch for light in hallway and Front door.
1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the ceiling
Front room 1 € 47,50 € 47,50 Eltako FT55 Double Switch for lights on the ceiling
1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the 1st Floor hallway
1 € 90,80 € 90,80 Eltako FTR55H Thermostat
Stairway clauset 1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the ceiling
Diningroom 1 € 47,50 € 47,50 Eltako FT55 Double Switch for light on the ceiling
1 € 90,80 € 90,80 Eltako FTR55H Thermostat
First floor Hallway 1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the ceiling
1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the 2nd Floor
Bathroom 1 € 47,50 € 47,50 Eltako FT55 Double Switches for 2 lights in the Bathroom (Ceiling and washbasin.
Bedroom 1 1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the ceiling
1 € 90,80 € 90,80 Eltako FTR55H Thermostat
Bedroom 2 1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the ceiling
1 € 90,80 € 90,80 Eltako FTR55H Thermostat
Bedroom 3 1 € 37,50 € 37,50 Eltako FT55 Single Switch for light on the ceiling
1 € 90,80 € 90,80 Eltako FTR55H Thermostat
Second floor Attic 1 € 47,50 € 47,50 Eltako FT55 Double Switch for light on the 1st and 2nd Floor
General House 9 € 60,40 € 543,60 Eltako FTK Window/door sensors
€ 1.535,10
Tax 19,50% € 299,34
Total € 1.834,44

The prices are the Eltako catalog prices. It costs a lot all together. Especially the Thermostats, Presence-sensors (not yet in the list) and Window/Door sensors make it expensive. Without these components it would be a lot cheaper but then the system would not be energy-efficient. In that case it is only luxury and the system will not finance itself over time. I estimate that energy reduction is about 20% on electricity and heating. My return on investment will be about 12 to 13 years. We do not only look at this economically but also the environmental aspect is important. We want to invest into our worlds future and then money becomes less important.

After careful considering piping and wiring for our new home I still made a mistake. I had asked for empty pipes to all rooms for wired presence sensors which I dismissed in the very end. I should not have done that. EnOcean sensors are much more expensive then the KNX wired ones. The Bathroom still has to be build and since it is a central room on the second floor I can reach most of the rooms from there. We will have to do that ourselves after the house is delivered.

17-05-2012

The Loxone System has arrived a week ago.

WP_000013 

WP_000012

The date for delivery of the house is set on june 6th. Take a close look. On the inside of the lid of the box a resistor is taped. You’ll need that to terminate the Loxone bus.

18-05-2012 Test setup

WP_000017

I did a test today with the Loxone System. At ‘Besselink’ in Arnhem I bought a Eltako switch which enables me to test the system. I had read a lot before buying and that payed off. I was able to connect all modules in less then 2 hours and then the excitement, did I do it correctly.

A problem I did not anticipate is that the Loxone system is tested before delivery (which is a good thing of course). But during testing a test setup is installed on the MiniServer that does (of course) not correspond with my setup. So at the first start all modules started blinking orange (except for the MiniServer). It took me a while to understand the software and load a correct setup into the MiniServer. After that all modules started blinking green (hurray) and I was able to do my first tests.

The software of Loxone is very extensive. In principal you can bind any input to any output. Not that this is what you would want in the end but in a test situation it’s nice to play around a bit Glimlach I have reached the point that I am starting to understand the full potential of my new Home Automation system and it is big.

20-5-2012 Eltako

It is very easy to transform the FT55 double switch it into a single one. On the left you see the double switch configuration and on the right the switch cover for the single switch.

WP_000024

Here is the switch as configured into one switch.

WP_000025

21-05-2012 Translated the article into English

08-06-2012 House owner

Since 6 June we are the proud owners of a nice house in Apeldoorn. Today I brought my test installation to the electrician that is going to install the system. The idea is that the current installation is completely replaced by a new one. He can do all the preparations at home. The first changes to the electrical system have already been done in the house. It is getting exciting now.

20-06-2012 Loxone installed

The installation of the system is taking its form. Here are a few pictures of the installation of the system by Henk Kooiman (in the picture) an independent electrician contracted by Rene vd Kamp (Van de Kamp Electrotechniek). The cabinet is, very professionally, equipped by Geyer (http://www.geyer.nl/).

image

image

image

image

 

 

Sonos interface

This started with me buying a Sonos Zoneplayer 90 last weekend. While looking for a solution for our (future) home I stumbled upon a shop in the town where we live. The owner of the store, a real audiophile, presented me with the Sonos solution. I was almost immediately impressed and convinced that this would indeed be the solution I was looking for.

When I got home I installed the ZonePlayer Software on my PC and after hooking the device up with my network started to enjoy the wonders of Sonos. In about half an hour I was able to configure the NAS in my network as the source for music, download the App for my IPhone and IPad, discover the device and ….. play music.

So far so good. Installation was real easy. Now I have a Logitech Harmony 1100 and I thought this was going to be easy too. I totally miscalculated this. This was not easy at all. I didn’t want to fallback to the situation where I would need multiple remotes again to control my devices. The Sonos devices don’t have IR. They totally rely on WiFi which the Harmony can’t. I started a search on the internet and found many frustrated with the same issue. Why oh why did Sonos choose not to implement the simplest IR control into the devices? All I’m asking for is the simple functionality like play, stop, next, previous and volume up/down. Then I would have been totally satisfied.

Then I found that Philips had cracked the code. With there Pronto TSU9600 and TSU9800 one can control the Sonos devices but, my goodness, at what a price. You’ll have to spend over $1000,00 for those controls and I read they aren’t easy to program. So I thought, if Philips can crack to code so can I.

I started looking for articles about this on the Internet discovered an article that said Sonos is using UPnP. I started digging deeper and found a nice website that has an UPnP SDK with tools and look what my first discovery is. The tool ‘Device Spy’ immediately found the Sonos and it’s interface. So here’s a starting point. Stay tuned.

SNAGHTML22cbf6

J River Media Center Remote control from Windows Phone 7

14 Sept 2011: MC Remote wins MarketRace competition at Macaw (www.macaw.nl).

A week ago (about the 7th September) MC Remote Pro was published by Macaw on the Marketplace. Since then more the 700 people downloaded the App. I was joining in a competition at Macaw’s called the MarketRace. MC Remote won the competition. I would like to thank all that have contributed to the success I had with MC Remote. Especially the people at J River (Jim Hillegas, Matt Ashland and others) for their support. Thanks all.

I’ve retreated MC Remote from the Marketplace. The PRO Version will be published soon for free by Macaw (www.macaw.nl).

SNAGHTMLfa1105

Although I don’t even have a Windows Phone (yet) I’ve started developing a Remote Control for Media Center Versions 14 and up based on the Web Service in Media Center. Above and below you can see some Images caught from the Emulator.

The project is hosted on SourceForge and can be found here.

The App has reached maturity. This is the functionality until now:

  • Settings for connecting to the server are stored in IsolatedStorage (meaning that with each start the settings can be retrieved from the memory of the phone)
  • Routines for reaching the server are working as expected
  • The App retrieves current playing info from the server and displays it. It also retrieves the image from the server (with some nice mirror reflection)
  • Buttons for Previous, Play/Pause, Stop and Next are working. Took the Layout from the Thunderstorm skin from MC)
  • Zones can be toggled and show information / search etc. accordingly
  • Added Page transition animations (see video)
  • Added Application bar (at the bottom) with menus
  • Restyled the App. Panorama view interfered with the sliders
  • Playlists are shown and can be played (as new or as next to play)
  • The Search panel is working. Play (as next) too.
  • In the Search panel multiple items can be selected and played (as new or as next).
  • Implemented the View page. From here MC can be controlled. The view can be set to Normal, Mini, Display, Theater or Cover.
  • Styled the navigation buttons using the MC Logo (cool). The images are a bit edgy.
  • Click and hold on a button now automatically repeats the action until released.
  • Planning for 2 versions.
    • Lite Free version with play control, Playlists and search (with only 1 item selectable).
    • Pro Paid version with all above and search with multiple selection and the new View Page.

Wishlist

Wish

Status

Support Zones Implemented
Support Search for Artist/Album/Song Implemented
Support for Access Keys Missing info
Support for LAN, WAN access and WOL Missing info

SNAGHTMLfc2ffaSNAGHTML2fad9abSNAGHTML1b64b5aSNAGHTMLff2d5bSNAGHTML1083853SNAGHTML1076720SNAGHTML1b6cc6bSNAGHTML1b774abSNAGHTMLfe786e