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


  • 5

SCENE. How to write to InfluxDb


10der

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

Please login or register to see this image.

/monthly_2020_06/grafana.png.75e34df6ebeb73619b4d174df798fccb.png" />

and Icon from HC2 user ;-) 

  • Thanks 1
Link to comment
Share on other sites

  • 0
Guest DigitalT

@10der

Love the script, thank you! 

 

Some suggestions to add for newbies like me in both HC3 and scripting,

 

-  What to add into declerations? 

- Add examples in comments where to change or add multiple devices?

- Add a example of the expected URL to influxDB from the script

- I also use InfluxDB protected with password so I added the variable and changed this in the code  :

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

Dear, I have copied and pasted the script into a scene edit window but cannot save it. Am I doing something wrong?

Link to comment
Share on other sites

  • 0
On 6/1/2020 at 9:03 PM, drboss said:

Honestly i am newbie and was not aware about it. Actually i found a declaration script, saved, but getting following error message: [23.03.2021] [18:42:04] [DEBUG] [SCENE12]: {"data":"{\"code\":\"unauthorized\",\"message\":\"Unauthorized\"}","status":401,"headers":{"Content-Length":"48","X-Platform-Error-Code":"unauthorized","Date":"Tue, 23 Mar 2021 17:42:00 GMT","Content-Type":"application/json; charset=utf-8"}}

 

Link to comment
Share on other sites

  • 0

Thanks for prompt reply, indeed I have login and pwd, actually i have set it in the script using local dbUser and local dbPass and have also adapted the local url 

 local url = "http://" .. host .. ":" .. port .. "/write" .. urlencode("?db=" .. dbName) .. ("&u=" .. dbUser).. ("&p=" .. dbPass), but still facing this error. Would it be better to have influxdb without login/pwd?
 
Link to comment
Share on other sites

  • 0
11 minutes ago, claudent said:

but still facing this error. Would it be better to have influxdb without login/pwd?

 

It would make it somewhat easier 

Link to comment
Share on other sites

  • 0

Thanks, but actually it looks like login/pwd is mandatory on influxdb (at least what i am using, on docker).

Link to comment
Share on other sites

  • 0

Thank you, but still getting error message. Actually i have a HC3 and my influxdb is running on docker (NAS Synology). A bit lost with this error message.

I have set login/pwd accordingly, but still not working.

 

[27.03.2021] [21:34:19] [DEBUG] [SCENE15]: {"status":401,"headers":{"X-Platform-Error-Code":"unauthorized","Date":"Sat, 27 Mar 2021 20:34:19 GMT","Content-Length":"48","Content-Type":"application/json; charset=utf-8"},"data":"{\"code\":\"unauthorized\",\"message\":\"Unauthorized\"}"}[27.03.2021] [21:34:19] [DEBUG] [SCENE15]: Wrong status '401' in response!

Link to comment
Share on other sites

  • 0
13 hours ago, claudent said:

Thank you, but still getting error message. Actually i have a HC3 and my influxdb is running on docker (NAS Synology). A bit lost with this error message.

I have set login/pwd accordingly, but still not working.

 

[27.03.2021] [21:34:19] [DEBUG] [SCENE15]: {"status":401,"headers":{"X-Platform-Error-Code":"unauthorized","Date":"Sat, 27 Mar 2021 20:34:19 GMT","Content-Length":"48","Content-Type":"application/json; charset=utf-8"},"data":"{\"code\":\"unauthorized\",\"message\":\"Unauthorized\"}"}[27.03.2021] [21:34:19] [DEBUG] [SCENE15]: Wrong status '401' in response!

@claudent I do believe that the difference is what version of Influx you are running. I have two RaspBerryPi, one running InfluxDB 1.8 (32bit) and one running InfluxDb 2.0 (64bit).

 

I see the exact same error messages on the InfuxDb 2.0 which is related to that this version have a different authentication system. I have so far not been able to solve that and have given up and only use the InfluxDB 1.8.

 

 

Link to comment
Share on other sites

  • 0
2 hours ago, claudent said:

I get it to work with influxdb 1.8, thanks alot.

Nice to hear that it worked! 

 

Link to comment
Share on other sites

  • 0

Hi, maybe stupid question but does this run locally so that you should have influxdb and grafana on e.g. a raspberry?

 

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.

×
×
  • Create New...