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

Hello everyone,

I am new in the home automation, and started with a Fibaro HC3;

I am trying to write to a InfluxDB all readings from a Aeotec HEM 3 phases meter and maybe in the future also some other data;

I have a Raspberry Pi4 where I installed IOTstack with Influxdb and Grafana containers and in my way to get all these measurements saved in influxDB and displayed in Grafana, I got stuck at Fibaro HC3;

Mainly, after applying the code I received the below errors in HC3 (if I understand correctly are 2 issues: one related to roomID and one related to device 64 which is the Aeotec 3Phase HEM):

Since I have not done any of these tasks in my life, I would really appreciate any help in this matter.

All the best, be safe

 

[14.07.2021] [17:43:00] [DEBUG] [SCENE75]: http://192.168.1.20:8086/write%3Fdb%3Dsmarthome
[14.07.2021] [17:43:00] [ERROR] [SCENE75]: (load):85: attempt to concatenate a nil value (local 'roomID')
[14.07.2021] [17:43:00] [DEBUG] [SCENE75]: {"data":"{\"error\":\"unable to parse 'Whole House Power,deviceID=64,deviceName=Whole_House_W,roomName=Hol\\\\ Dormitoare,sectionName=Hol value=0.0 1626273780000000000': invalid field format\"}\n","headers":{"Date":"Wed, 14 Jul 2021 14:43:00 GMT","Content-Length":"179","X-Request-Id":"c969e27a-e4b1-11eb-802a-0242ac120004","X-Influxdb-Error":"unable to parse 'Whole House Power,deviceID=64,deviceName=Whole_House_W,roomName=Hol\\ Dormitoare,sectionName=Hol value=0.0 1626273780000000000': invalid field format","Request-Id":"c969e27a-e4b1-11eb-802a-0242ac120004","X-Influxdb-Build":"OSS","X-Influxdb-Version":"1.8.6","Content-Type":"application/json"},"status":400}
[14.07.2021] [17:43:00] [DEBUG] [SCENE75]: Wrong status '400' in response!

Link to comment
Share on other sites

  • 0

On my HEM G2 3 phase, I read the total power consumption with the following code lines.
First I poll the master and a second later I read of Total Power which is sent to a Raspberry with Influx and Grafana (no IoT stack).
 

Please login or register to see this code.

 

Edited by RH_Dreambox
Link to comment
Share on other sites

  • 0

Thank you for the response @RH_Dreambox

But I am really new and with 0 knowledge in the linux, fibaro and all other programing languages & codes, therefore my question the code in your response above may be added or should replace some lines in the code above by 10der? 

Link to comment
Share on other sites

  • 0

Hi @CCF I understand, programming LUA is not so easy in the beginning.

 

If you have not edited 10der's code, the following lines of code are for you to edit, replace or deactivate.
To deactivate the code, add two minus signs first in the code line.
If you later add more of your own devices, just delete the minus signs and enter your own ID numbers.

So delete or rather, disable the code as I show below.
 

Please login or register to see this code.

 

EDIT.....

NOTE! In beta 5.072, Fibaro has changed the parameter "power" to "value"!

 

Then copy in my code with the ID of your Aeotec HEM 3.

 

Please login or register to see this code.

 

If you want to read power for each phase, you can also add these lines with ID for each phase.

 

Please login or register to see this code.

 

Edited by RH_Dreambox
Link to comment
Share on other sites

  • 0

Noted, thanks

 

 

Thanks for the update,

however after getting error [SCENE75]: (load):85: attempt to concatenate a nil value (local 'roomID')

I deleted a empty room (no devices) and copy pasted again the whole code into the scene and now I am getting the following "emptyerror message

 [16.07.2021] [17:56:44] [ERROR] [SCENE75]:

which does not seems very helpful  

Edited by CCF
added in response to "value" to "power" change
Link to comment
Share on other sites

  • 0

Have you disabled this line, approx. row 15 ?

 

Please login or register to see this code.


It is only used if you have a HomeTable, which I assume you do not have.

Link to comment
Share on other sites

  • 0

Hello @RH_Dreambox;

thank you,

I managed to get the reports in influxDB, unfortunately, after 1 week of reporting, Fibaro they decided to update the HC3 firmware again and they changed how HEM Gen5 is proving reports, and number of child devices are doubled now (1 set for production (kWh, W, V, A, for total and for each phase) + 1 set for consumption), I had to reset the meter. And I have to repeat the procedure again for the new devices IDs now.

 

 The line mentioned above, was already removed as per an earlier post.

The error above I believe that was related to the fact that I was looking to get the readings from one particular temp and humidity device (aerQ from aeotec) but in the same room I had mentioned a main room device for temperature and humidity (a netatmo) and the script, if I understood correctly, it will report ONLY the device which is listed as the main for the room.

 

Link to comment
Share on other sites

  • 0

Hello @CCF

It is true that the scene reports many devices automatically.
But you can manually add optional devices no matter what room they are in.
If you get an ERROR, you may have entered the wrong ID or the wrong power / value.

Here are some of my devices that are logged in to Influx.

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

Thanks @RH_Dreambox,

for the moment I am collecting all the info which is available on raspberry pi and setup the grafana charts for them.

Few questions, if you can help in this regard, (to ensure that my understanding of how HEM Gen5 works and the updated Fibaro firmware 5.072.25);

After the HC3 update to firmware 5.072.25; and reseting of the HEM, I am getting 1 parent device with ~ 30 child devices; looking at the readings, it seems that now I am getting the reports for consumption and production.

Furthermore, I assumed that main child devices (i.e. the ones which reports the overall kWh, W, V and A) are the ones with xx.0  in the device name.

Is my understanding correct?

Link to comment
Share on other sites

  • 0

@CCF

Something must have gone wrong because there should only be 1 parent device (Main, hidden) and 16 child devices.
I suggest you remove HEM from the network and then do a factory reset of HEM (press the button for 15 sec.).


The child devices that may remain after the exclusion may be deleted manually.
Then include HEM to the network again.

Link to comment
Share on other sites

  • 0

@RH_Dreambox

Not very good news,

just finished connecting again all readings to influxdb and grafana, I have work for tommorow 

Is factory reset required for HEM only? Or do I need to do a factory reset for the HC3 also?

 

I reset the HEM , remove it from ZWave, added back, update the HC3 to 5.080 but I got the same number of child devices (32: 16 for Consumption and 16 for production) . I even added in the setting of HEM the parameter which specifically mention that solar power is not applicable, but no change in number of child devices.

 

Edited by CCF
Update
Link to comment
Share on other sites

  • 0

@CCF

Could it be that you have a later model of HEM G5 and that you therefore have double child units?
Maybe you can just hide the duplicates?

 

My "HEM G5" is a little older model DSB28-ZWEU 2nd edition
Version 1.7
Z-Wave version 3.67

 

And this is what my parameter list looks like right now.

Parameter 3: Current: 1
Parameter 5: Current: 50W
Parameter 6: Current: 50W
Parameter 7: Current: 50W
Parameter 9: Current: 10%
Parameter 10: Current: 10%
Parameter 11: Current: 10%
Parameter 101: Current: 14
Parameter 102: Current: 4 144 911
Parameter 103: Current: 769
Parameter 111: Current: 120S     (Prev. 675 225 487s)
Parameter 112: Current: 120s
Parameter 113: Current: 1 800s

 

EDIT: A bug in HC3?
I have previously tried to change parameter 111 to 120 seconds, but the value has always jumped back to 675 225 487 Sec.
But when I changed from Template mode to List mode it worked, so now the value is 120 sec.

Edited by RH_Dreambox
Link to comment
Share on other sites

  • 0

@RH_Dreambox

Yes your HEM seems to be a G2, series, I purchased mine just 2 months ago and it they called a G5, anyway, it seems that you have a template for your meter (I assume so since your are able to see the parameters which are setup on the meter), for the G5 Fibaro do not have a template, and I cannot see any parameters. I just override some parameters to bet readings on all phases and the sum for entire house, as per aeotec documents. And indeed this what I have done, I hide all the production child devices, since I do not have solar or similar power generation capabilities.

 

Anyway with the help on this forum I managed to get some Grafana charts, thank you all

 

Now I need to find some way to get the readings from the HomeKit devices into Grafana, at least in this way I can have them all in one place

Cheers

Please login or register to see this attachment.

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
8 minutes ago, ppeterr said:

@SmartHomeEddy

 

Yes i have, and i also found that topic. Tried that script, but didnt manage to get it to work

I'll continue there, to keep this topic focussed on the pollen quickapp. Thanks

 

 

What InfluxDB version do you use?

 

(1.8 and 2.0 have an authorization difference)

 

Link to comment
Share on other sites

  • 0

I could need some help. Got influx running with grafana, and the influx database as source.

I made a scene, with the code on first page of this topic. And edited the ip/port/dbase name.

When i run the scene it errors.

 

[17.08.2021] [15:58:32] [ERROR] [SCENE73]: (load):78: attempt to concatenate a nil value (local 'roomID')

 

So probably there is some more editing to do.

 

Running 1.8 - without auth.

 

 

 

Edited by ppeterr
Link to comment
Share on other sites

  • 0
3 minutes ago, ppeterr said:

[17.08.2021] [15:58:32] [ERROR] [SCENE73]: (load):78: attempt to concatenate a nil value (local 'roomID')

 

 

I think this could be the solution?

 

On 7/16/2021 at 5:24 PM, RH_Dreambox said:

Have you disabled this line, approx. row 15 ?

 

Please login or register to see this code.


It is only used if you have a HomeTable, which I assume you do not have.

 

On 7/29/2021 at 8:59 AM, CCF said:

The line mentioned above, was already removed as per an earlier post.

The error above I believe that was related to the fact that I was looking to get the readings from one particular temp and humidity device (aerQ from aeotec) but in the same room I had mentioned a main room device for temperature and humidity (a netatmo) and the script, if I understood correctly, it will report ONLY the device which is listed as the main for the room.

Edited by SmartHomeEddy
Link to comment
Share on other sites

  • 0

Ah, I see

 

You could, for testing purpose, change the line: 

Please login or register to see this code.

with a fixed value of an existing roomID. 

 

Link to comment
Share on other sites

  • 0
18 minutes ago, SmartHomeEddy said:

Ah, I see

 

You could, for testing purpose, change the line: 

Please login or register to see this code.

with a fixed value of an existing roomID. 

 

 

If i only would know where to find the ID :)

 

I tried with swagger, and that gives me: 

Please login or register to see this code.

As results for the room id's....not much :)

 

[edit] i found it

Please login or register to see this code.

 

 

Edited by ppeterr
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...