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


Question

Posted

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

Recommended Posts

  • 0
Posted

Please login or register to see this image.

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

and Icon from HC2 user ;-) 

  • Thanks 1
  • 0
Guest DigitalT
Posted

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

 

  • 0
Posted

Hello

When I try to execute scene, I receive below error. Any idea?

 

Please login or register to see this attachment.

  • 0
Posted

Hey, i'm feeling really stupid. But is this a scene in HC3 or a QuickApp?

  • 0
Posted

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

  • 0
Posted

Did you add a declaration?

  • 0
Posted
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"}}

 

  • 0
Posted

Sounds like you have an authorization in your Influx database

  • 0
Posted

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?
 
  • 0
Posted
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 

  • 0
Posted

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

  • 0
Posted

Have created a new login/pwd free influxdb, but still have the same error.

  • 0
Posted

able to use user and password

 

Please login or register to see this code.

 

  • 0
Posted

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!

  • 0
Posted
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.

 

 

  • 0
Posted

Thanks alot for your feedback, I will try influxdb 1.8 and see what will be the result.

  • 0
Posted

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

  • 0
Posted
2 hours ago, claudent said:

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

Nice to hear that it worked! 

 

  • 0
Posted

I really appreciate your support.

 

  • 0
Posted

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

 

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