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

HC2 trigger on change of power from wall plug


Question

Posted

Hi,

 

I'm trying to set up a one-way connection from my Verisure alarm to my HC2. I have a Verisure smart plug, which is plugged into a Fibaro wall plug. I have then added a small charger, which draws 0.7W.

The idea is that I will program Verisure to turn OFF the smart plug when I turn on the alarm. This will then turn off all lights, and turn down the temperature. 

 

As of now, I have two challenges:

  • The power consumption shown in the HC2 web interface is correct. But is not updated when I turn the smart plug on/off. If I select the "poll this device" it is updated correctly. 
    • To address this I have changed the polling time interval for this device to 10 seconds, but don't have a good feeling about doing polling. 
    • Can anybody tell me what I should be looking for. Here are my wall plug parameters
      • Par 1: 1 (Activated always on)
      • Par 12: 5s (Reporting interval)
      • Par 14: 5s (Report interval)
    • PS. Have also tested with a lightbulb which draws 40W, but still no reporting.

 

  • With the polling, the power is updated. My question is, how can I have a script executed based on this change?

 

 

16 answers to this question

Recommended Posts

  • 1
Posted
1 minute ago, jsetsaas said:

When the power changes once, I get the text "Started by change of property: power" twice.

It probably means you got 2 different readings. Try Parameter 11 = 100 to disable small changes. Might work...

 

5 minutes ago, jsetsaas said:

And unless I have missed something, this means that the script is started twice for one power change.

There might be a small time difference, debug has only 1 second resolution, it is hard to say if they ran at the same time.

As soon as you add fibaro:sleep(some_value) your script will take longer to run and changes increase that a scene gets (re-)triggered.

 

8 minutes ago, jsetsaas said:

Probably not a big problem, but for a lengthy script, it could cause problems if two instances are running in parallell.

Lua is pretty fast, API calls are reasonably fast, the problem starts when you use loops and "sleep".

 

See:

 

 

And especially this one, mentioned on that page:

 

 

  • 0
Posted

Please set parameters 40 and 42 to reflect small changes in power.

  • 0
  • Inquirer
  • Posted

    Thanks for your answer.

     

    But I don't understand why "Power load for violet colour" and "LED ring colour controlled device is OFF" should affect this.

    I am using the com.fibaro.PGWP102

    • 0
    Posted
    12 minutes ago, cag014 said:

    Please set parameters 40 and 42 to reflect small changes in power.

    I think he might have a FGWPEF-102 instead of a -101 (because he says p12 =  reporting interval) so you mean parameter 10 and 11 which is good advice.

     

    What is the difference in load? In watt?

    • 0
    Posted

    Yes,I thought it is FGWP101

    Please follow Peter's parameters numbers

    • 0
  • Inquirer
  • Posted

    Hi guys,

     

    And thanks for your help. Much appreciated.

     

    I changed params 10 and 11 to 10%. I also replaced the charger with a lightbulb. So the values I have is 0W and 37W.

    Reporting interval is set to 5s.

     

    But I still have to select "Poll this device" to see the change of power usage.

     

    As I can get around this by using polling...

     

    This leads me to the second question. How can I start a LUA script when the power changes?

    • 0
    Posted
    13 minutes ago, jsetsaas said:

    But I still have to select "Poll this device" to see the change of power usage.

    I suspect... If you do not get power indications, then the on/off status of the plug is also incorrect when you toggle it by clicking the button on the device?

    It happens when you are missing an association in group 1 (device, advanced, button "associations") to your controller, this is device "1".

    Can you check this? If it is there, you can try to remove it, save, then add it back, save.

     

    If you plug in a lamp, a few seconds later you should see a change on your HC

     

    17 minutes ago, jsetsaas said:

    This leads me to the second question. How can I start a LUA script when the power changes?

     

    In the header add ID of plug and "power" under %%properties, like this:

     

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    Yes, you're right. I do not get on/off indications either.

    I did change param 1 to "always ON", 

    I have now changed this back to 0, and can now turn the device on/off with the switch and from the WebUI.

    But the changes done with the switch are NOT detected.

     

    Under Associations there are three groups: Group1, 2 and 3.

    Removed Group1 and re-added it.

    But still no go...

     

    ---

     

    OK. The power interrupts where easier than I though. Will have a try. Thx.

    • 0
    Posted
    17 minutes ago, jsetsaas said:

    But the changes done with the switch are NOT detected.

    Sounds a lot like missing association

     

    17 minutes ago, jsetsaas said:

    Removed Group1 and re-added it.

    Almost there... Click on that group, then add a checkmark next to "Home Center 2". That means the plug can send data to your HC. I don't know if this by default is S or M or both (I don't have a -102 plug here) but I think it does not matter much. Try M first. Then "save" button at the bottom of the open window.

     

    • 0
  • Inquirer
  • Posted

    Great. That did the trick :-)

    When I now turn the light-bulb on/off, the power is almost immediately updated in the webUI.

    Thank you so much for your help.

     

    As for the trigger, I played around with the following script:

     

    --[[
    %% properties
    239 value
    239 power
    --]]

    fibaro:debug("Hello world");

     

    This works fine, but I get TWO interrupts when I turn the light bulb on or off. 

    (Only ONE interrupt if I turn the wall plug on or off)

    If I remove the "239 value", I get nothing.

    And if I remove the "239 power" I only get interrupt when turning the wall plug on or off.

     

    Any ideas?

     

     

     

     

    • 0
    Posted

    Can you please try this scene, because I think it will help you understand why a scene instance starts:

     

    Please login or register to see this attachment.

     

    I attached it as a file and not as a code block because sometimes copy/past from the forum fails and inserts invalid characters.

     

    If you toy with power on/off and/or change the load you should see output like this:

     

    Please login or register to see this code.

    But with id 239.

     

    I did not fully understand your question in post 1 so I'm giving you a generic approach to find out what causes your code to run...

     

    • 0
  • Inquirer
  • Posted

    Hi again, and thanks for the script. This runs fine.

    But what I see is that when I change power, the script is started twice. (Changing the setting runs it only once).

     

    When the power changes once, I get the text "Started by change of property: power" twice.

    And unless I have missed something, this means that the script is started twice for one power change.

     

    Probably not a big problem, but for a lengthy script, it could cause problems if two instances are running in parallell.

     

     

     

    • 0
  • Inquirer
  • Posted

    Hi, and again thanks for your valuable assistance.

     

    I think I understand what is happening. When I turn off the light bulb, it doesn’t go from 40W to 0W, but in the UI I see some random number in between. And this will of course send another trigger. So since I am only interested in detecting a binary change, I should be able to program my way around this, and ignore the transient state. (Which may not even be a problem when I replace the light bulb with a charger, haven’t tested that yet).

     

    Also thanks for the links. Will spend some time there before I continue.

     

    • 0
  • Inquirer
  • Posted

    Thanks for the input. The script runs fine now, but have have one minor challenge.

     

    Quick recap: I have a powerplug which is turned on/off when I turn on/off my alarm system. This is to tell the Fibaro system that the alarm is turned on/off, and take appropriate actions (turn off lights etc). In this powerplug, I’ve added a small charger, which draws about 2W. So then the alarm is turned on, the powerplug is enabled, which then triggers the fibaro script.

     

    The physical setup is like this:

    - Power outlet —> Fibaro smart plug —> Alarm smart plug —> Charger

     

    So in this way I have a one-way signal from my alarm system to Fibaro.

     

    When the alarm is turned on, the fibaro script is triggered, as the load changes from 0 to (about) 2W. All good.

    When the alarm is turned off, the fibaro script is triggered, as the load changes from (about) 2W to 0. All good.

    However, the charger is not 100% stable, and fluctuates between 2, 2.1 and 2.2 W. And each of these changes also triggers the script. Not a huge problem but very irritating. 

     

    How can I avoid this?

     

    Thank you.

    • 0
    Posted (edited)

    @jsetsaas why not use one plug switched by you're alarm en connect a 230v relais that switches a fibaro ubs? and i do think youre alarm has relais outputs so you can connect a fibaro ubs to you're alarm system. (i don't know youre type alarm system)

    Edited by akatar
    • 0
  • Inquirer
  • Posted

    My alarm system does NOT have any switched outputs. But I can program it to turn on/off a smart plug when the alarm is turned on/off.

    This is an alarm delivered by an alarm company, so I can and will not make any changes to this.

     

    If you have any other suggestions as to how Fibaro can detect the status of this switch, I would be happy to learn this..

    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.

    ×
    ×
    • Create New...