more G-Labs products

Author Topic: X10 LW12 Dim level synchronisation problem  (Read 3387 times)

May 23, 2014, 12:12:00 AM
Read 3387 times

Boeky

  • **
  • Information
  • Jr. Member
  • Posts: 31
Hi,


A couple of days ago I started using HomeGenie on a Raspberry Pi B. The software is working well but I found some weird behavior and I wonder if this is correct?

Let me give a short description of my home automation system :

I'm using X10 LW12 Dimmers ( http://www.marmitek.com/en/product-details/x-10/x-10-home-automation/micro-modules/lw12.php) together with X10 TWM4 Transmitters (http://www.marmitek.com/en/product-details/x-10/x-10-home-automation/micro-modules/twm4.php) behind Niko buttons

The button behaviour works like this :
Short press -> Toggles between sending ON and OFF x10 commands
Long press - > Toggles between sending DIM(5) and BRIGHT(5) every second as long as you hold the button

The LW12 dimmer reacts on these commands without any problem.
The problem for Homegenie is that the LW12 saves the last level stand so Homegenie loses synchronisation

Example :

1 Set lamp on with homegenie -> no problem
2 Control level with homegenie to 50 percent -> no problem, the lw12 dims to 50 percent
3 Set lamp off with homegenie > no problem, the lw12 receives the off command and dims to 0 but it also saves the last dim level of 50%
4 Set lamp on with homegenie -> Problem : the lw12 receives the the on command and turns on to the last saved stand of 50% but the homegenie software is indicating that it is on at 100% When you then set homegenie to 70%, the lamp continues to dim to 20%.

Both dimmer options of the homegenie software "save last dim stand" and "bright to 100% when turning on" are off.

Using "save last dim stand" doesnt work with these modules as they keep lowering the level.

Using "Bright to 100% when turning on" is the only method to put the dimmer back in sync. but i prefer tu use last dim level of my module

Using both options at the same time isnt a solution as it seems that the "bright to 100%" triggers last...

Is there any reason why the software sets the level to 100 procent instead of the las level when turning on modules?
Is there any solution for this problem?

The basic ActiveHome software of X10 doesnt have this problem but the Homegenie software is way more advanced and expandable. Im just trying to figure out why this basic function is causing trouble.

I tought the CM15pro keeps track of all x10 commands on the net and is storing all levels? Is there a synchronisation between levels of the CM15pro and the Homegenie or does Homegenie evaluates incoming x10 signals itself?
When I programmed with ActiveHome and other Software on windows I always used sending absolute dim levels with extended x10 code. So you dont loose the synchronisation. I think homegenie is using calculated Bright or Dim commands so you can lose synchronisation


I'm still very new to linux so I still need to search where I can find the core files of HomeGenie



Kind Regards,
Thanks,

Christophe

August 12, 2014, 06:52:06 PM
Reply #1

celloweb

  • *
  • Information
  • Newbie
  • Posts: 16
Hi,

I can confirm the strange behavior when dimming X-10 lights. I'd tested the funcionality with my WA12A decora X-10 wall dimmers and cannot be able to set the % to 50, since HG starts to send multiples dim commands: 32%, 27%, then 0%. I have HD installed in a RPi rev B, CM15a on USB, and HG 403. Since the dimmer funcionality is so unstable for X-10 dimmers, I am using only the ON-FF commands.

August 12, 2014, 08:31:36 PM
Reply #2

Gene

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

you can modify the "Level Memory" program so that it will only remember the last level without actually issuing any dim/bright command.

Trigger Code
Code: [Select]
Program.Setup( () => {
Program.AddFeature("Dimmer", "HomeGenie.LevelMemory", "Recall last light level when switched on");
Program.AddFeature("Dimmer", "HomeGenie.LevelMemory.SimulateOnly", "Simulate only");
});
// this program will be running in background
return true;

Code to Run
Code: [Select]
// We want to do further processing whenever a module changes
When.ModuleParameterChanged( (module, property) => {
// stores the Status.MemoryLevel value for recalling last light dimmer level
// when switched on
  if (module.HasFeature("HomeGenie.LevelMemory") && module.IsOfDeviceType("Dimmer") && property.Name == "Status.Level")
{
  var level = module.Parameter("Status.Level");
var memory = module.Parameter("Status.MemoryLevel");
//
        if (level.DecimalValue != level.LastDecimalValue)
        {
            bool justswitchedon = (level.LastDecimalValue == 0 && level.DecimalValue > 0);
          if (justswitchedon)
            {
                // set current level to memory level if different
                if (level.DecimalValue != memory.DecimalValue && memory.DecimalValue > 0)
                {
                    var newlevel = (int)(memory.DecimalValue * 100);
                    Program.Notify("Level Memory", module.Instance.Name + "<br>" + module.Instance.Address + " set to " + newlevel + "%");
                  if (module.HasFeature("HomeGenie.LevelMemory.SimulateOnly"))
                    {
                      Program.RaiseEvent(module, "Status.Level", memory.Value, "Memory Level");
                    }
                  else
                    {
                      module.Level = newlevel;
                    }
                    // returning false, prevent from routing event to other listeners                 
                    return false;
                }
            }
            if (level.DecimalValue > 0)
            {
                memory.Value = level.Value;
            }
        }
    }
  // returning true, will route event to other listeners
    return true;
});

Program.GoBackground();

Once the program is updated you'll have a new option for Level Memory (see attacched screenshot).

Let me know if this is working for you.

Cheers,
g.

August 12, 2014, 09:26:44 PM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
I had to modify something in the XTenLib.dll to make this work.
The new Level Memory program and the new xtenlib are included in the update r410.

Cheers,
g.

August 13, 2014, 05:44:00 AM
Reply #4

celloweb

  • *
  • Information
  • Newbie
  • Posts: 16
Thanks Gene, I'll check it. By the way, congrats for your amazing work.

Marcus (from Brasil)

August 14, 2014, 03:06:34 AM
Reply #5

celloweb

  • *
  • Information
  • Newbie
  • Posts: 16
Not working ...

22:01:15.126   Status.Level   0.395714285714286   A7   HomeAutomation.X10
22:01:14.620   Status.Level   0.685714285714286   A7   HomeAutomation.X10
22:01:12.785   Level Memory   Luz Sala TV
A7 set to 71%   16   HomeAutomation.HomeGenie.Automation

Probably because I'm not able to change the A7 from Energy Saving to Level Memory (tried everything, even delete the module).