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

check if usage is < 40 watts then variabel is


Question

Guest imparator
Posted

Hi, i want to check the next with lua

when it is between 23.00 - 03.00 and the switch usage is < 40 watt

set variable to 1

else variable is 0

this is the code now but it is not working :

Please login or register to see this code.

can some one help me please?

7 answers to this question

Recommended Posts

  • 0
Guest imparator
  • Inquirer
  • Posted

    deanrparry, version is beta 4.022 , and the wall plug of fibaro is the device

    • 0
    Posted

    Try this

    Please login or register to see this code.

    • 0
    Guest imparator
  • Inquirer
  • Posted

    petergebruers, i added your code, i will test this , i have 2 scene's

    one checks the usage, and set a variable, ( your code )

    second one checks the variable and power off the on off switch

    is this also possible to put it in one scene ( your code )

    so i have then one scene do the same thing ?

    and i have the same situation for upstairs,

    maybe is it possible to combine everything in one scene ?

    thx for your code

    +

    When i test this code i get this error :

    [ERROR] 13:23:38: line 62: attempt to compare nil with number

    • 0
    Posted

    Sounds as if the device PowerUsageID doesn't support valueSensor. I tested the code with a Fibaro Wall plug... What kind of device is yours? I see you mentioned "wall plug"

    Alternatively, post the result of

    Please login or register to see this link.

    (replace 192 etc with your HC2 IP and 273 with your device ID) - if you're running HC2 beta V4.

    For HC2 running the stable V3 post the result of

    Please login or register to see this link.

    (replace 192 etc with your HC2 IP and 273 with your device ID)

    • 0
    Guest imparator
  • Inquirer
  • Posted

    petergebruers, here is the result

    its a fibaro wall plug

    {"id":206,"name":"Kelderkast","roomID":1,"type":"com.fibaro.FGWP101","baseType":"com.fibaro.binarySwitch","enabled":true,"visible":true,"isPlugin":false,"parentId":205,"remoteGatewayId":0,"interfaces":["energy","light","power","zwave","zwaveAlarm","zwaveAssociation","zwaveConfiguration","zwaveFirmwareUpdate","zwaveSlaveRouting"],"properties":{"parameters":[{"id":1,"lastSetValue":1,"size":1,"value":1},{"id":16,"lastSetValue":1,"size":1,"value":1},{"id":34,"lastSetValue":63,"size":1,"value":63},{"id":35,"lastSetValue":0,"size":1,"value":0},{"id":39,"lastSetValue":600,"size":2,"value":600},{"id":40,"lastSetValue":80,"size":1,"value":80},{"id":42,"lastSetValue":15,"size":1,"value":15},{"id":43,"lastSetValue":30,"size":1,"value":30},{"id":45,"lastSetValue":10,"size":1,"value":10},{"id":47,"lastSetValue":3600,"size":2,"value":3600},{"id":49,"lastSetValue":0,"size":1,"value":0},{"id":50,"lastSetValue":300,"size":2,"value":300},{"id":51,"lastSetValue":500,"size":2,"value":500},{"id":52,"lastSetValue":6,"size":1,"value":6},{"id":60,"lastSetValue":25000,"size":2,"value":25000},{"id":61,"lastSetValue":1,"size":1,"value":1},{"id":62,"lastSetValue":8,"size":1,"value":8},{"id":63,"lastSetValue":1,"size":1,"value":1},{"id":70,"lastSetValue":65535,"size":2,"value":65535}],"associationSet":[{"devices":[],"groupID":1},{"devices":[],"groupID":2},{"devices":[1],"groupID":3}],"associationView":[{"devices":[],"groupID":1},{"devices":[],"groupID":2},{"devices":[1],"groupID":3}],"zwaveCompany":"Fibargroup","zwaveInfo":"3,3,52","zwaveVersion":"22.22","pollingTimeSec":0,"alarmLevel":"0","alarmType":"0","color":"white","configured":"true","dead":"false","deviceControlType":"20","deviceIcon":"28","emailNotificationID":"0","emailNotificationType":"0","endPointId":"0","energy":"15.51","isLight":"false","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"false","model":"","nodeId":"24","parametersTemplate":"225","power":"87.20","productInfo":"1,15,6,0,16,0,22,22","pushNotificationID":"0","pushNotificationType":"0","remoteGatewayId":"0","saveLogs":"true","showEnergy":"true","smsNotificationID":"0","smsNotificationType":"0","useTemplate":"true","userDescription":"","value":"true"},"actions":{"associationGet":1,"associationSet":2,"getParameter":1,"reconfigure":0,"reset":0,"setParameter":2,"turnOff":0,"turnOn":0,"updateFirmware":1},"created":1418763604,"modified":1418763604,"sortOrder":23}

    • 0
    Posted

    Sorry, my bad! I forgot that your HC2 is running version 4 software, not version 3. The property "valueSensor" was renamed to "power". Unfortunately I can't test it, but a simple replace of line

    Please login or register to see this code.

    with

    Please login or register to see this code.

    Should work

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