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


Define custom properties in QA


rhalbheer

Recommended Posts

Hi All,

when I look at the openweathermap QA example, they defined their own properties like wind etc. As I would like to grab the rain as well, I would like to add a custom property to the QA in order to be able to access this information from another scene or QA.

How do you define customer properties in a QA? I was now search of a long time without success :-(

When I just do a self:updateProperty("rain", 0) nothing happens

Thank you

Roger 

  • Thanks 1
Link to comment
Share on other sites

@A.Socha@jgab

4 hours ago, rhalbheer said:

Hi All,

when I look at the openweathermap QA example, they defined their own properties like wind etc. As I would like to grab the rain as well, I would like to add a custom property to the QA in order to be able to access this information from another scene or QA.

How do you define customer properties in a QA? I was now search of a long time without success :-(

When I just do a self:updateProperty("rain", 0) nothing happens

Thank you

Roger 

 

ugly but works:

 

 

local users = {
    Oleg   = {mac = "", presence = false, lastSeen = 0},
    Helena = {mac = "", presence = false, lastSeen = 0},
    Katrin = {mac = "", presence = false, lastSeen = 0},
    Sofiya = {mac = "", presence = false, lastSeen = 0},
}
 

[skipped]

 

self:updateProperty("userDescription", json.encode(users))

 

Link to comment
Share on other sites

2 hours ago, 10der said:

@A.Socha@jgab

 

ugly but works:

 

 

local users = {
    Oleg   = {mac = "", presence = false, lastSeen = 0},
    Helena = {mac = "", presence = false, lastSeen = 0},
    Katrin = {mac = "", presence = false, lastSeen = 0},
    Sofiya = {mac = "", presence = false, lastSeen = 0},
}
 

[skipped]

 

self:updateProperty("userDescription", json.encode(users))

 

It seems like the device definitions for the different device types are defined by xml schemas that only accept specific fields. Therefore we can’t add any property to devices, although different devices have different fields.

Link to comment
Share on other sites

  • Topic Author
  • Hmm, interesting. But the openweathermap QA has properties like temperature, humidity etc. So, there has to be a way. I might need to look at the exported QA then. But this would be quite a hack. This QA actually brought me to the idea. I uncommented the rain part of the QA and added it to a label. It would be nice to have it in the properties as well as this would be really easy to access from other QAs and get the value transported without exposing it in the variables.

    Link to comment
    Share on other sites

    16 minutes ago, rhalbheer said:

    Hmm, interesting. But the openweathermap QA has properties like temperature, humidity etc. So, there has to be a way. I might need to look at the exported QA then. But this would be quite a hack. This QA actually brought me to the idea. I uncommented the rain part of the QA and added it to a label. It would be nice to have it in the properties as well as this would be really easy to access from other QAs and get the value transported without exposing it in the variables.

    If you create a QA with the same device type you will get the same properties.

    Yes, the argument for custom property fields is that fibaro.getValue would work.

    Link to comment
    Share on other sites

  • Topic Author
  • @jgab: True but somehow the person who did the openweathermap QA defined custom properties and I do not get how. It is not part of the fqa file but it is there if you go to /api/devices/<id>. I would have expected that the self:updateProperty would work the same way as self:setVariable to define a new one but this does not seem to work.

    So, again, somehow it has to be possible because openweathermap seems to have done it or not?

    • Thanks 1
    Link to comment
    Share on other sites

    But if you create a QA of type com.fibaro.weather you get temperature, humidity, wind,weathercondition, conditioncode properties.

    But you can't add rain (unless as a part of weathercondition).

    These are the same properties as openweathermap has.

    No custom properties, just the properties supported by the com.fibaro.weather device type.

    Edited by jgab
    Link to comment
    Share on other sites

    Hi guys,

    In HC2  I had a scene and VD  OWM. I  have used clear sky, over clouds and clouds>>> it will trigger to close curtain by sunshine between time frame (sunrise+01:00..sunrise+01:30)

    How to accomplisch in HC3?

    thanks in advance,

    //Sjakie

    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
    Reply to this topic...

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