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


  • 3

SCENE. How to write to InfluxDb


10der
 Share

Question

Please login or register to see this code.

 

a special thanks @tinman ?

 

 

Please login or register to see this attachment.

 

Please login or register to see this attachment.

 

 

 

 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Recommended Posts

  • 0

i just dont know, how would the line be if the ID would be 220

 

line 77 and 78 ?

 

 local roomID = 220
    local room = api.get("/rooms?id="..roomID)

 

results in

 

[17.08.2021] [16:36:58] [ERROR] [SCENE73]: /opt/fibaro/lua_engine/lua/engine/fibaro_sdk.lua:236: Assertion failed: Expected number

Edited by ppeterr
Link to comment
Share on other sites

  • 0

Please login or register to see this code.

 

Something is happening in this part of the code. If I look at Swagger, maybe change to:

 

Please login or register to see this code.

 

If that doesn't help, maybe change (for testing purpose) this line to:

 

Please login or register to see this code.

(brute force :-) )

Link to comment
Share on other sites

  • 0

Uhmm almost, i now get a empty error :) joehoe

 

function saveByDeviceID(measurement, deviceID, property)
    property = property or "value"
    local roomID = 220
    local room = api.get("/rooms/"..roomID)
    local section = api.get("/sections/"..room.sectionID)
    local value = fibaro.getValue(deviceID, property)
    saveToInflux(measurement, value, deviceID, fibaro.getName(deviceID), "default", "default")
 
 
[17.08.2021] [16:58:46] [ERROR] [SCENE73]:  joehoe, nee die error stond hier niet :P
Link to comment
Share on other sites

  • 0

this is what i have now, forced to room id 220. And edited a few id's

 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

And it works?

 

 

1 hour ago, ppeterr said:

this is what i have now, forced to room id 220. And edited a few id's


@10der would turn around in its digital grave 😬 You better look out, he is like Drakula, sometime he is back 👻
 

 

 

Edited by SmartHomeEddy
Link to comment
Share on other sites

  • 0
38 minutes ago, SmartHomeEddy said:

And it works?

 

 


@10der would turn around in its digital grave 😬 You better look out, he is like Drakula, sometime he is back 👻
 

 

 

 

Well, bite me. It doesnt work :)

 

Or at least, if this is the output i need.....

[17.08.2021] [19:10:27] [ERROR]

Anyway, for this day...i'm done....time flies when doing stuff like this.

 

Link to comment
Share on other sites

  • 0
5 hours ago, SmartHomeEddy said:

Maybe put some debug messages in the code, to see what is happening 

 

Started fresh, again it failed to get the room ID. Removed the line 

local roomID = fibaro.getRoomID(deviceID) again. So it uses the room id 200.

 

Again it ends up with.

 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

when i add 

Please login or register to see this code.

 

after

 

Please login or register to see this code.

it results in

 

8086://192.168.1.134/write%3Fdb%3Dpi

 

Makes me a little confused 😐

 

So, i changed that to

 

local url = "http://" .. host .. ":".. port .. "/write" .. urlencode("?db=" .. dbName)

 

And it works....is this topic a test or somthing :P come on.....

Edited by ppeterr
Link to comment
Share on other sites

  • 0

@SmartHomeEddy

 

So, i have it running. Now i need to set the declaration for the scene. I was thinking to set some

timer, run every 15mins, and also a refresh in grafana for 15 mins. How do you do it, and how would 

the declaration look like. I tried to make one in a block scene, but it seems i cant make a timed declaration

with that. Or better. Only a timer.

 

How do you have this sorted ?

 

@10der

 

I'd like to thank you for this script. Thanks!

 

Could you explain to me why the local url syntax is formatted to start with the port ?

I changed it, now it works. But it seems not to work as it is in the openings post.

Edited by ppeterr
Link to comment
Share on other sites

  • 0
  • Inquirer
  • 30 minutes ago, ppeterr said:

    Could you explain to me why the local url syntax is formatted to start with the port ?

    I changed it, now it works. But it seems not to work as it is in the openings post.

    Fibaro playing with url format

    at first time this format for Fibaro was ok

    after some time Fibaro changed url format to normal

    so you right 

    Link to comment
    Share on other sites

    • 0
    3 minutes ago, 10der said:

    Fibaro playing with url format

    at first time this format for Fibaro was ok

    after some time Fibaro changed url format to normal

    so you right 

     

    Thanks for clearing that up.

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