Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

[SCENE] Fail-safe fibaro:call()


cag014
 Share

Question

Hi everyone.

I have few devices that don't react properly to simple "turnOn", "turnOff" actions. Might be Z-wave unresponsive at that time  or RF interference or they're too far away from controller or they'e dead. Anyhow when executing fibaro:call(devID,"turnOn") the device doesn't always turning ON (same case for OFF). 

This phenomena very frustrating especially on predefined events that don't act as expected ( like turn on Fan in bathroom when humidity high, close garage if no presence detected at home,  turn on/off water heater according to temperature and etc.)

Attached scene code is verifying that the device is not dead, command transferred to device and device has changed the state. In case of problem  email sent to notify about problem. In addition I have found that this scene is very efficient to identify unresponsive Z-wave situation and I'm using this scene to turn on/off  some device every hour just to see if Z-wave is OK.

Some basic instructions:

1. Create new LUA scene and copy attached code in it.

2. Scene call syntax:   fibaro:startScene(sceneID, {devID, "turnOn"})  - same parameters as original fibaro:call()

That's all for basic.

In addition there are two options:

1. If you have device that you want to be notify by email at any time that the device state has been changed (in my case garage gate and water heater), please add third Boolean parameter:  fibaro:startScene(sceneID, {devID, "turnOn",  true}). You will receive an email  one every state change of the device. Could be changed into push notification.

Please login or register to see this attachment.

2. If you need to receive scene status of the action or debug information, please follow next instructions:

  • Add "predefined global variable" by name jCall.
  • In order to receive correct response you need to make sure that the scene is executed before that, so the suggested scene call is:

fibaro:startScene(sceneID,{devID,"turnOff"})
 x=os.time(); while (fibaro:countScenes(sceneID)>0 and os.time() - x < 10) do end

 jFc = json.decode(fibaro:getGlobalValue("jCall"))

fibaro:debug(jFc.resp) -- print debug information

Please login or register to see this attachment.


  if (jFc.status == 1) then

  -- success - write your code

else

  -- action failed write your code

end

Note: In case the device already at the same state, email sent to notify that the device state is the same and no action performed.

Please login or register to see this attachment.

 

Scene Code below and attachment 

Please login or register to see this attachment.

 

Please login or register to see this code.

 

Edited by cag014
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...