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

Device class


ggoetz56
 Share

Question

Hi,

I want to know the ID's of all my window/door sensors. But my question is more basic.

 

i.e. ids = fibaro:getDevicesId({interfaces ={"energy"}}) This will give me a list battery powered devices.

 

So I presume something like that: ids = fibaro:getDevicesId({Type ={"door"}}) will give me the id's of my doorsensors.

How could if find out the parameters of the getdevicesId() function?

 

Thanks for any hints.

Gerhard

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0
8 hours ago, ggoetz56 said:

Hi,

How could if find out the parameters of the getdevicesId() function?

 

 

1

 

did you see that:

http://hc2_ip/api/devices

?

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanx 10der,

    for answering, But its hard for me to see the difference between

    "type": "com.fibaro.doorSensor",

    "baseType": "com.fibaro.doorWindowSensor",

    or how to manage information like 

    "interfaces": [ "battery", "fibaroAlarm", "fibaroAlarmArm", "fibaroBreach", "tamper", "zwave", "zwaveAlarm", "zwaveSceneActivation", "zwaveWakeup" ],

    when fibaro:getDevicesId({interfaces ={"energy"}}) works

    "energy" is not mentioned in the interfaces optionlist above.

     

     

     

     

    Link to comment
    Share on other sites

    • 0

    more examples

     

    allBattDevices   = fibaro:getDevicesId({interfaces = {"battery"}, enabled = true, visible = true})

     

    local security_devices = fibaro:getDevicesId(
        {
              enabled = "true",
              visible = "true",
              interfaces = {"fibaroAlarmArm"},
              isTypeOf = "com.fibaro.doorSensor",
              properties = { alarmExclude = "false" }
        }
    )
     

        local devicesbl = fibaro:getDevicesId({
              enabled = true,
              visible = true,
              type="com.fibaro.motionSensor"
        })
     

    PS:  I don't wanna  to provide a complete solution cuz (as is usually the case) a next step "please help me write completely script" :) 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 minutes ago, 10der said:

    "please help me write completely script"

    That's what i absolutely want want to avoid. Especially in this case  I got a working script but don' t understand why it works or better saying how the author manage to make it work. 

     

    Link to comment
    Share on other sites

    • 0

    OK!

     

    Please login or register to see this link.

    and the last example from Fibaro sources

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0

    There's nu public list of device types.

    But here's an idea...

     

    Go to a device in the browser, then click on the spanner icon... Note number at the end of the URL

     

    http://192.168.0........./fibaro/en/devices/configuration.html?id=717

     

    Prepare an url like this

     

    http://192.168.0......./api/devices/717

     

    You'll get a json object containing all properties.

     

    For instance... You'll find this under "properties":

    ....

       dead: "false",

    ....

     

    This means you can filter on this property like this:

     

    Please login or register to see this code.

     

    You'll also find "type" in that json, but note "type" is not under "propertes". If you want to list all first gen Wall Plus:

     

    Please login or register to see this code.

    Then combine stuff:

     

    Please login or register to see this code.

     

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi 10der,

     

    that a good example to explain my problems with fibaro:lua.

    On 7/27/2018 at 9:47 PM, 10der said:

    fibaro.getDevicesId = function(self, filter) if type(filter) ~= 'table' or (type(filter) == 'table' and next(filter) == nil) then return fibaro:getIds(fibaro:getAllDeviceIds()) end

    reading your example and the PDF-Doc i can't find a reason why fibaro:getAllDeviceIds() should work. You define a table fibaro.getDevicesId and filter the list that 

    Fibaro:getIds(filter) will give. But what is fibaro:getalldeviceIds().

    Where do find the statement fibaro:getalldeviceIds() and how do you know what it will give to you? 

     

     

    Link to comment
    Share on other sites

    • 0
    19 minutes ago, ggoetz56 said:

    getAllDeviceIds

    it's

    Please login or register to see this link.

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • so i can't manage a http:-connection to my intranet from herein i have to see what i find in the api about that today evening.

    Thank you :D

    off topic.

    is there a posissibility to change an icon by lua? 

    I would see a red open door if one of three doors are open and a green closed when all these doors are closed.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 6 hours ago, 10der said:

    it's

    Please login or register to see this link.

    Thats what the api/divices gives to me. Nothing about fibaro:getalldviceids()

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
    On 7/30/2018 at 3:56 PM, ggoetz56 said:

    is there a posissibility to change an icon by lua? 

     

    ChangeSceneIcon.lua 


     

    Please login or register to see this code.

     

    VD_sample.json


     

    Please login or register to see this code.

    if you asking me how to change device icon - simple upload two icons for device

    Please login or register to see this image.

     

     

     

    Edited by 10der
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks 10der,

    but will I be able to choose on/off Icons with VD?

    Link to comment
    Share on other sites

    • 0
    20 minutes ago, ggoetz56 said:

    Thanks 10der,

    but will I be able to choose on/off Icons with VD?

    no. but this steps can useful for you

    1) google img. note: please set 128x128 (sample link 

    Please login or register to see this link.

     )

    2) choose and save to disk two imgs

    3) select VD

    4) change VD icon (button)

    5) upload two imgs

    Please login or register to see this image.

     

    6) writedown id's (it's hard for not developers part)

    fFKcaDc3XO.png

     

    7) write code

    8) hurray!

    EUKN2COfmI.png

     

    HMs7mKhOZT.png

     

    or

     

    5tRwSSK5vp.png

     

    oIlgG3BiYL.png

     

     

     

     

     

    Edited by 10der
    Link to comment
    Share on other sites

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