Setting a switch on for x times

Hello

I don’t have the Vera Lite yet. Could please someone verify that this is possible to do with a Fibaro relais:

Switch 1 ON 0.5 sec, OFF for 0.5 sec ON 0.5 sec, OFF for 0.5 sec ON 0.5 sec, OFF for 0.5 sec

Switch 2
ON 0.5 sec, OFF

Switch 1
ON 0.5 sec, OFF for 0.5 sec
ON 0.5 sec, OFF for 0.5 sec
ON 0.5 sec, OFF

Thank you!

dawiinci

I don’t know any Z-Wave relay that will provide that level of precision, reliably.

The Fibaro relay has a configurable Automatic shutoff that can be set between 10ms and 2.5 seconds. But, to do what you request, 3 On Off request within 3 seconds, you would still have to send multiple Z-Wave On commands at one second intervals and these will almost certainly get delayed by status updates.

If I had to achieve that switching frequency, I would probably implement an Arduino controlled relay.

What is your intended application?

The time doesn’t have to be so precise.

I want to control shades by manipulating a remote control. To do so I have to switch through 5 channels by pushing a button repeatedly. Once the command is sent out I have to set the channel back to channel 1, so the system “knows” how many times it has to repeat the signal to switch to channel 4 (three times).

If I can do this repeatedly by software I think a delay wouldn’t be an issue.

I’m open for any advice.

My advice would be to look at Fibaro’s roller shutter controller (FGRM-222) and see if you can incorporate that into your shades. It would be far better than trying to use a relay to tap ‘Morse code’ into your remote control.

I can only do it by radio. It is a Somfy RTS system.
However the ZRTSI or URTSI is not available in Europe.

What do you think, is it possible to do so?

It may be possible to do what you want using Z-Wave relays but I suspect you will have difficulties getting the RTS channel selection to work reliably. One missed cycle and you’ll start controlling the wrong blind. It would be much easier to use single-channel Somfy RTS remotes.

You would get better timing accuracy using a Wifi Relay Board rather than Z-Wave switches. These are controlled with simple commands via UDP which could be sent from Lua code in a scene.

I used a similar approach for single Somfy RTS channels using the same type of Wifi module as that on the relay board. I wrote a plugin that emulates a normal WindowCovering device. See WifiRTS. I have three of these operating and they work very well. The plugin devices are supported by AuHomationHD (alpha).

If neither of these approaches appeal, consider the Arduino approach as suggested by @Z-Waver.

Thank you, good ideas!

However I want to avoid additional powered devices as well as Wifi components.

Back to the initial idea:
If the switch sends the signal it doesn’t matter if it is sent for 0.1 sec or 1 sec. Just the number of ON-OFF cycles has to be perfect. So in case of a power off it would probably not be in the correct state. Which has to be corrected manually. As far as I know the system reports back if the switch is ON. So this is what I could do to avoid the signal being sent twice because of a missing OK signal:

Switch 1 ON wait until OK and wait 0.5 sec OFF wait until OK and wait 0.5 sec ON wait until OK and wait 0.5 sec OFF wait until OK and wait 0.5 sec ON wait until OK and wait 0.5 sec OFF wait until OK and wait 0.5 sec

Switch 2
ON wait until OK and wait 0.5 sec OFF wait until OK

Switch 1
ON wait until OK and wait 0.5 sec OFF wait until OK and wait 0.5 sec
ON wait until OK and wait 0.5 sec OFF wait until OK and wait 0.5 sec
ON wait until OK and wait 0.5 sec OFF wait until OK

Is it possible to delay a command in this way?

I know the use of one remote would increase the reliability but then I have to buy 5 Switches instead of 2 and 4 additional remotes.

It is possible to use delays in Lua code in scenes. Short delays can be done with luup.sleep(milliseconds). Longer delays should use luup.call_delay(…). See Call Delay. If you try to delay too long using luup.sleep(), Vera can assume that the scene has stalled and perform a restart.

I think you will find it difficult to get this working reliably but, if you want to try, here is some code to get you started. I use this code in conjunction with a Fibaro FGS211 relay that is set for auto-off after 500ms (Configuration parameter 4 = 5). The code turns on the relay, polls it until it has turned off then waits one second and repeats this as specified in pulseCount. I use it for an audible alert.

local pulseCount = 5 local dID = 37 for i=1,pulseCount do luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, dID) for j=1,30 do luup.sleep(200) if luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status",dID) == "0" then break end end luup.sleep(1000) end

Personally I would not use this for anything important. The reason I went to the trouble of building a Wifi interface for RTS and wrote the plugin is that I wanted it to work correctly every time - regardless of what else Vera was doing at that moment.

Thanks for the script! I think I have to learn Lua. :wink:

I will probably add a separate remote to simply close an open all shades automatically. The manual control is only used when at home.

Do you think Fibaro’s roller shutter controller (FGRM-222) would be better than the normal switch from Fibaro? They both have to channels, but the switch might be more versatile and can be used f?r 1.5 kW.

I don’t know any switch with more than 2 channels though.

Do you think Fibaro's roller shutter controller (FGRM-222) would be better than the normal switch from Fibaro? They both have to channels, but the switch might be more versatile and can be used f?r 1.5 kW.

I have no experience with the FGRM222. I use the FGS211 and FGS221 extensively and they are excellent devices with great flexibility.

I don't know any switch with more than 2 channels though.

I did find a Z-Wave switch with four channels. See HSK-320Z but it was going to be expensive to buy just one from China.

Would the Fibaro universal sensor (FGBS-001) work with this as well? As I know it has 2 dry contacts for OUT. This device is simply cheaper so if I can switch them on and control the remote it would be even better. The input I wouldn’t use for now.

What do you think?

[quote=“dawiinci, post:11, topic:178873”]Would the Fibaro universal sensor (FGBS-001) work with this as well? As I know it has 2 dry contacts for OUT. This device is simply cheaper so if I can switch them on and control the remote it would be even better. The input I wouldn’t use for now.

What do you think?[/quote]
The Universal Binary Sensor doesn’t have Z-Wave controlled outputs. The dry-contact outputs just follow the inputs. It is designed that way for connection between sensors and alarm panels.

Good to know. But I should be able to read out the sensor state (e.g. closed circuit)?

Are we still on the same subject: Pulsing a switch to control an RTS remote? The Fibaro Universal Binary Sensor cannot be used to do that. It can be used as an input device for two dry contacts and up to four DS18B20 temperature sensors.

Yes sorry, I was already thinking of another use for the sensor. :wink:

I want to know wheter a circuit is closed or not. This should happen wireless.

[quote=“dawiinci, post:15, topic:178873”]Yes sorry, I was already thinking of another use for the sensor. :wink:

I want to know wheter a circuit is closed or not. This should happen wireless.[/quote]

The UBS will do that but the contacts must be dry (volt-free) to switch the UBS input to GND. You can configure the UBS for normally-open or normally-closed contacts.

I can make the switch go on and of with 1 second delay without issues. So my plan seems to work. However I want to make it faster. How can I wait for a command to be finished before doing the next one? (e.g. wait until it is on before switching off)

I want to use Lua code for this.