The Vera Community forums have moved!

General => Blinds & Window Covering Control => Topic started by: Sp0oNy on March 17, 2014, 08:43:33 am

Title: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: Sp0oNy 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.
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: zwavemotors 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?
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: Sp0oNy 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.

Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm 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.

Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm 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) ?)
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm 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!
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm 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>
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 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.
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm on June 15, 2014, 01:22:06 pm
You're welcome ;)
Let me know how it works for you!
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 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

Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm 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
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 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!
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 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?
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm 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) ;)
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 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.
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 on June 22, 2014, 05:06:19 am
Some more testing ...

Quote
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

The if statement does't seem to work for me. I tested on 2 blinds, none of them will change their tilt any more, regardless of their loadlevestatus (no change in tilt even if completely closed).
I just realized that some of my blinds show a wrong position in the UI (e.g. 0% even if their completely closed). So this will also be problem when using the loadlevelstatus to decide for which blinds to change the tilt.
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm on June 23, 2014, 06:47:22 am
Hi,

Good to know that the tilt can be changed while the blind is in motion  8)

The "if" statement provided was not tested and indeed incorrect, sorry for that. I got the level % inverted. Correct code, for blinds <= 80% open would be:

            if tonumber(luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", tonumber(device))) &lt; 80 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


However, I also have just figured out that the level reported by the FGRM gets incorrect after some time (in my case, it reports 100% open even when fully closed)... until this bug is identified/fixed, this "if" statement is indeed useless...
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 on June 23, 2014, 07:09:17 am
Thank you for the new if statement.
I read on an other thread that someone has raised a ticket on the issue of incorrect % readings.
I would't hold my breath though that we will see a fix soon.

I'm trying come up with a PLEG condition that fires when one of my door blinds was manually opened to go through the door.
There are triggers for "device is turned on/off", that won't tell me about a manual up command.
The properties of the FGRM didn't look promising eather. "Status" property is 0 in upper and lower position.
Do you know if "status" can be used to identify an "UP" movement?
Anything else?
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 on July 11, 2014, 08:12:50 am
I just found out that the FGRM-222 devices have a scene controller capability like the Fibaro dimmers.
I am using this to set a virtual "manual mode" for the blinds at doors so that I won't be locked out when the blinds go down.

On a FGRM-222 Set parameter 50 to 1
do the vera dance
double click the up or down buttons of the FGRM
open the device, and on the advanced tab will be 3 new variables:
LastSceneID, LastSceneTime, sl_SceneActivated

in PLEG create 3 device properties
p_blind_kitchen_door_SceneActivated
p_blind_kitchen_door_LastSceneTime
p_blind_kitchen_door_LastSceneID

create a condition in PLEG (not my finding, this was discovered by someone else), e.g. c_kitchen_door_manual_mode_on
(p_blind_kitchen_door_SceneActivated;p_blind_kitchen_door_LastSceneTime) AND (p_blind_kitchen_door_LastSceneID == XX)

whereas XX can be set to
14 UP double click
15 UP triple click
24 DOWN double click
25 DOWN triple click

You can use the condition c_kitchen_door_manual_mode_on to avoid blind movement when manual mode is on.
I found UP double click for manual mode on and DOWN double click for manual mode off easy to remember.
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 on July 17, 2014, 02:10:12 am
I almost have everything working the way I want it to. Almost.
I followed @cedricm instructions and created 2 new devices to have different tilt angles for different windows.
The original one works like a charm, the 2 new ones don't react to changes of the slider at all.
I double checked the device IDs for the blinds.
I have no idea what is going wrong.
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: cedricm on July 18, 2014, 03:44:57 am
Hi

Thanks for sharing your scene-based setup ;)

For your second slider, make sure that you have specified the proper implementation file when creating the device.
On the 'Advanced' tab of your 2nd device, check "impl_file" (should be I_FGRMLamellasDimmer.xml).
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: quanghaitrieu6 on September 16, 2014, 09:50:03 pm
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>


too many!! Thanks again!
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: esieczek on October 16, 2016, 04:08:26 pm
Hi guys,
Has anybody tried that with UI7. I'm quite new to LUA and it would be great to have step by step instruction how to use tilt control with venetian blinds. I would appreciate any help.
Regards
Greg


Wysłane z iPhone za pomocą Tapatalk
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: Alextaz on January 04, 2017, 02:26:21 am
Hello,

Same question here... is the frgm-222 working good with ui7 and venetian stores on vera ?
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: Alextaz on February 10, 2017, 03:41:11 am
Hello,

Does anybodycould confirm that the CEDRICM code always work on UI7 and vera lite ?!

Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: pls90 on February 10, 2017, 05:43:58 am
I started to move my devices from vera light to plus with ui7. Tilt of blinds can be controlled by @cedricm's dimmer device
Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: Alextaz on February 15, 2017, 06:24:54 am
Ok, i finally confirm the tilt of blinds works with cedricm code on my vera lite with ui7

I've got a problem with on of my three venetian blind...after the blind close it reopen for a few seconds, i make a vid?o here to show you the problem :

https://youtu.be/jIpVaJFLKfA (https://youtu.be/jIpVaJFLKfA)


Title: Re: Fibaro Roller Shutter 2 (FGRM-222) with venetian blinds
Post by: EtKa on October 15, 2018, 05:40:57 am
Hey

I'm trying to implement cedricm's code. (Using vera plus with ui7).

I've uploaded his code and created the new device according to his instructions but it doesn't communicate with the fibaro module.

my module parameters are:

parameter 3 = 1
parameter 10 = 2
parameter 12 = 140
parameter 50 = 1

I would be thankful for some help :)