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

Wall plug and power reporting - LUA


Question

Posted

Hi,

what's the properties to use to implement actions in LUA that act

on current power output on a wall plug?

I want to turn on a RGBW dimmer based on power use of my TV, to turn on the lights when the TV is on and shut them off when the TV is off.

I can do it using the standard scene blocks, but how do I do it using LUA?

I can't find any info on this on docs.fibaro.com.

/Fredrik

8 answers to this question

Recommended Posts

  • 1
Posted

here you will find all data

Please login or register to see this code.

  • 0
Posted

FredrikN,

Here sample to do anything when wall plug meters more than 5 watts:

Please login or register to see this code.

where 25 - device ID of wall plug, and 5 - watts.

-------

Or create scene in blocks and convert it to LUA using interface.

  • 0
  • Inquirer
  • Posted

    Ahh, valueSensor! I'll have a try on this tonight.

    Is there a documentation that shows this or is it just word-of-mouth?

    • 0
    Posted

    FredrikN,

    when you edit scene in LUA mode, then on the left panel you have all variables and devices, and you can "hover" over them and see all properties. When you click on that - code pasted in current cursor position.

    Try

    Sorry, no picture - I am behind firewall.

    • 0
  • Inquirer
  • Posted

    That's very useful!

    I'm a bit ashamed I missed that, but I have mostly edited my LUA scripts offline.

    • 0
    Posted

    FredrikN, another simple trick - as you mention you could almost do what you wanted to do with blocks just start of with that and then convert it over to LUA. Very simple and quick way to learn the commands.

    • 0
  • Inquirer
  • Posted

    All very useful. Wrote the test code yesterday and it was solved quickly.

    Thanks all!

    [ Added: 2014-01-23, 19:26 ]

    And here is my final code:

    Please login or register to see this code.

    • 0
    Posted

    For all who find this thread via search or link:

    For V 3.X use valueSensor

    For V 4.X use power

    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...