Author Topic: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds  (Read 9365 times)

Offline Sp0oNy

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« on: March 17, 2014, 08:43:33 am »
Hi,
I just installed a FGRM-222 on my Somfy Venetian Blind (between RTS receiver and motor).

Everything works fine, except the lamellas tilt.
I'm able to open/close, move up/down/stop, but I'm not able to manage lamellas orientation.

My settings are :
 - option 10 set to 2
 - option 13 set to 0
 - option 14 set to 1
 - option 29 used once to calibrate and deleted once done.

Will the lamellas tilt be implemented ? When ?

Thanks.
Aymeric.

Offline zwavemotors

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-2
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #1 on: March 18, 2014, 09:51:14 am »
Can you share how you wired the Fibaro module and the RTS receiver together?
Is the tilt function still working from the Somfy remote?
Do you know what type of Somfy motor is in the headrail?

Offline Sp0oNy

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #2 on: March 18, 2014, 10:20:01 am »
Can you share how you wired the Fibaro module and the RTS receiver together?
Is the tilt function still working from the Somfy remote?
Do you know what type of Somfy motor is in the headrail?

Yes, I plan to share it on a blog with he wiring diagram... I'll post it here too.

All the previous fonctions of my Somfy remote are still working through the fibaro.
Note that I only have the basic Telis remote : Up/Down/'My' only, without tilt function.

My motor is a J4, and the receiver is a standard Somfy RTS.


Offline cedricm

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #3 on: June 13, 2014, 06:29:09 am »
Hi there,

Also just installed a FGRM on my Venetian blinds (also powered by a Somfy J4).

Works great except, obviously, the missing tilt control from the UI (works fine from the physical push button though).

Would be great to have a dump of ZWave data sent by a Home Center when changing tilt (it's possible to send arbitrary ZWave data using luup, so implementing a separate dimmer to control the lamellas might be doable).

I tried to analyze the ZWave data sent by the FGRM to the Vera when manually changing tile. The only stuff that is reported is the blind opening % and power usage. So I guess that the FGRM also needs to be told to send "tilt-aware-controller" data.


Offline cedricm

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #4 on: June 14, 2014, 05:21:00 am »
Actually, parameter 3 needs to be set to 1 to get the lamellas tilt report when manually operating the blind.
When paramter 3 is set to 1, the ZWave frame sent by the FGRM to report a change is the following:

0x91 0x1 0xf 0x26 0x3 0x3 <blind %> <lamella tilt % (0x63 = 99 = vertical, 0 = horizontal)>


0x91: is the Manufacturer Proprietary command class
0x1 0xf 0x26 0x3 0x3: needs to be decoded (I guess that 0x26 has something to do with the venitian blind feature)

Next step is to try to decode this and see what command can be sent back to the FGRM to change opening/tilt (using luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SendData",{Node="<ZWave node ID>, Data="0x91 <...>"}, 1) ?)

Offline cedricm

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #5 on: June 14, 2014, 05:29:17 am »
Mostly good!


My current understanding of the fibaro command class protocol for the FGRM is the following:

0x91 0x1 0xf 0x26 <blind command> <lamellas command> <blind %> <tilt %>

<blind command>: 1 = SET, 2 = ? (GET, I guess), 3 = REPORT
<lamellas command>: 1 = SET, 2 = ? (GET, I guess), 3 = REPORT
<blind %>: 0 to 99%, 0 = fully closed, 99% = fully opened
<lamellas %>: 0 to 99%, 0 = vertical, 99% = horizontal

It seems that blind % and tilt % can't be changed simultaneously.
When using command #1 for <lamellas command>, <blind command> & <blind %> seems to be ignored
So to change <blind %>, it seems that using command #2 for <lamellas command> works.

Still need to do more test, and as I don't have any Fibaro documentation of their proprietary protocol this is just plain guessing.

So disclaimer here: you are on your own, if you break something due to this, I'm not responsible -- use at your own risk!


So, to change blind position from a LUUP scene (an easier way is to use the standard ZWave dimmer command, this is just to verify my understanding of the protocol):

blind_position=0 -- closed, acceptable values: 0 to 99 (in %)
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SendData",{Node="<zwave node id>", Data="145 1 15 38 1 2 " .. blind_position .. " 0"}, 1 )


To change lamellas orientation :

tilt=50 -- change tilt to 50%, acceptable values: 0 (vertical) to 99 (horizontal) (in %)
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SendData",{Node="<zwave node id>", Data="145 1 15 38 1 1 0" .. tilt}, 1 )


:)

Next step: implement a nice standard dimmer control to wrap this in a nice and standard UI!
Next next step: implement automatic lamella tilt by tracking the sun during the day!
« Last Edit: June 14, 2014, 08:00:22 am by cedricm »

Offline cedricm

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #6 on: June 14, 2014, 09:06:26 am »
Next step done: I now have a dimmer controlling the tilt of my Venetian blinds!

It's a standard dimmable light control, so that the tilt can be controlled from any UI (builtin Vera web interface, AutHomation...).
This dimmer is also able to control multiple blinds simultaneously (set the tilt once, and all connected blinds will move to this new value).

For those interested, here is the required bit of code and instructions.

I renew my disclaimer: use at your own risk!


<?xml version="1.0"?>
<implementation>
  <functions>
    -- Copy this file as I_FGRMLamellasDimmer.xml in /etc/cmh-ludl on the Vera
    --
   -- Manually create a new device (Apps / Develop Apps / Create device)
   --   device_type: urn:schemas-upnp-org:device:DimmableLight:1
   --   device_file: D_DimmableLight1.xml
   --   impl_file: I_FGRMLamellasDimmer.xml
    --
    -- Add the following variable to the newly created device (Advanced tab) to connect it to the FGRM(s)
    --   . New service: "urn:fibaro-com:serviceId:FGRMLamellasDimmer1"
    --   . New variable: "Devices"
    --   . New value: FGRM device ID, or if many, comma separated list of FGRM device IDs


   function setLamellasTilt(lul_device, percent)
        if percent >= 100 then
            percent = 99
        end

        local devices = luup.variable_get("urn:fibaro-com:serviceId:FGRMLamellasDimmer1", "Devices",  lul_device) or ""
        for device in string.gmatch(devices, "[^,]+") do
            luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SendData",{Node=tostring(luup.devices[tonumber(device)].id), Data="145 1 15 38 1 1 0 " .. percent}, 1 )
        end

        if percent == 0 then
            luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status",  "0", lul_device)
        else
            luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status",  "1", lul_device)
        end
        if percent == 99 then
            luup.variable_set("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", 100, lul_device)
        else
            luup.variable_set("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", percent, lul_device)
        end
        luup.variable_set("urn:micasaverde-com:serviceId:HaDevice1", "LastUpdate", os.time(), lul_device)
   end
  </functions>
  <actionList>

    <action>
     <serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
     <name>SetTarget</name>
      <run>
          if lul_settings.newTargetValue == "1" then
              setLamellasTilt(lul_device, 100)
          else
              setLamellasTilt(lul_device, 0)
          end
      </run>
    </action>

    <action>
     <serviceId>urn:upnp-org:serviceId:Dimming1</serviceId>
     <name>SetLoadLevelTarget</name>
      <run>
          setLamellasTilt(lul_device, tonumber(lul_settings.newLoadlevelTarget))
      </run>
    </action>

   </actionList>
</implementation>
« Last Edit: June 15, 2014, 01:21:16 pm by cedricm »

Offline pls90

  • Full Member
  • ***
  • Posts: 183
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #7 on: June 15, 2014, 05:39:17 am »
@cedricm this is excactly what I was looking for. To be able to control the tilt of all my blinds with one dimmer device is absolutely incredible. Well done. Thank you so much.

Offline cedricm

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #8 on: June 15, 2014, 01:22:06 pm »
You're welcome ;)
Let me know how it works for you!

Offline pls90

  • Full Member
  • ***
  • Posts: 183
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #9 on: June 17, 2014, 10:32:35 am »
I followed your description and have now a slider device for my blinds. Started testing on one blind.
When I move the slider from 0% to 50% the UI updates the device to 50%, blind changes tilt as expected. Great!
The next move of the slider to e.g. 80% will not be updated in the UI, device still shows 50%.
Tilt of blind does change to 80%.
So the only thing not working is the reported tilt percentage in the UI.

I thought how to go forward from here and would be interested about you opinion.

I use some PLEG conditions / actions together with the heliotrope plugin to control my blinds. South and West side are controlled interdependently, so I plan to use 2 devices to change tilt of S and W side according to the altitude variable of the heliotrope plugin.
Do I need to check if every individual blind is actually down before changing tilt angle?
Even if the PLEG has closed all blinds someone could have manually openened one or more blinds to go through one of three doors into the garden.
I don't want to change tilt of a blind that has not been closed, even if the end switches would prevent damage to the blind motor. If that happens on a regular basis it will certainly not extend the mtbf of the end switches.
But - with over 15 blinds this will make the PLEG conditions rather complex.
Am I overcomplicating things?

I have to say I'm very pleased with what you have accomplished.  ;D


Offline cedricm

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #10 on: June 17, 2014, 11:00:34 am »
What UI are you using?
I don't see why it wouldn't always get the new tilt value.
Seems to be fine for me with both the standard MCV web UI & AutHomation.
Maybe this is just your UI/Vera being slow to propagate the new value to your UI.

However, bear in mind that the dimmer is not notified of manual changes (this would require a firmware upgrade from MCV to properly parse the reports sent back by the FGRM).


Otherwise, I didn't know about the heliotrope plugin... you probably saved me a few (?) hours worth of work implementing the same thing... thanks :D

I haven't implemented what you are trying to achieve yet... but I guess that, for each blind, I will check that it's at least 33% closed before changing it's tilt (just to be on the safe side too).
So I guess that my dimmer implementation can/will be updated a bit to ignore the tilt order when opened ;)

E.g., this is probably just a matter of changing

luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SendData",{Node=tostring(luup.devices[tonumber(device)].id), Data="145 1 15 38 1 1 0 " .. percent}, 1 )

with

if tonumber(luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", tonumber(device))) > 33 then
    luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SendData",{Node=tostring(luup.devices[tonumber(device)].id), Data="145 1 15 38 1 1 0 " .. percent}, 1 )
end

Offline pls90

  • Full Member
  • ***
  • Posts: 183
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #11 on: June 17, 2014, 11:29:24 am »
I'm on 1.5.622.
I waited for more than an hour, no UI update. I don't think my vera is that slow. ;-)
So I'm not paranoid about checking whether each blind is opened before changing tilt after all. I'll try your suggested change as soon as possible. Hell, this IS a lot easier than putting it in PLEG conditions. 8-)
Thanks again!

Offline pls90

  • Full Member
  • ***
  • Posts: 183
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #12 on: June 18, 2014, 04:04:29 am »
Ok, did some more reading and got the UI to show the right dim level. I had to set parameter 3 to 1 as you already stated was necessary.
Another thought:
Is it possible to store the desired tilt level into the target device?
If I can't do that I would have to wait for all of the blinds to reach their desired position and then send the command to set the tilt level. Any thoughts on this?

Offline cedricm

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #13 on: June 21, 2014, 08:09:29 am »
Hi,

If you set parameter 3 to 1, the Vera won't be able to decode the report sent by the FGRM when manually operated ;) (e.g., if someone changes the position of the blind manually, the Vera won't know).
And I fail to see how this would help having the correct tilt value in the dimmer.

Another thought:
Is it possible to store the desired tilt level into the target device?
If I can't do that I would have to wait for all of the blinds to reach their desired position and then send the command to set the tilt level. Any thoughts on this?

I don't see any parameter in the FGRM that would allow setting the target tilt value. This is possible with the FGD-221, but not for the FGRM as far as I know.
So I guess you indeed have to wait for the blind to reach their final position before changing the tilt... unless... did you try to change the tilt while the blind is moving up/down? maybe the FGRM already deals with that after all. I haven't test this yet.
If one really needs to wait for the blind to stop before changing the tilt value, this can be done by monitoring the blind power usage (and waiting for the power usage to be <= 1W) ;)

Offline pls90

  • Full Member
  • ***
  • Posts: 183
  • Karma: +1/-0
Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
« Reply #14 on: June 21, 2014, 07:20:56 pm »
I did some testing a few days ago. Even when in motion FGRM stores the value for the desired tilt angle. So we don't have to wait until the blinds are in their final position. If the blinds are completely open (upper end position) sending a tilt change command will cause them to move shortly. So checking if they're open more than x% should still be done. I will try to change parameter 3 again and see if tilt value is reported in the UI.