Smartmeter

Hi, I’m a very beginner at OH3.
My first attempt is to get the data of my electronic power consumption in OH3
I’m using the binding “smartmeter”. After some testing it seems to work. The state I’d online, on the debug page are data.
Now I have to create items and link them to the channels. At this point I’m lost. All the examples I found are for OH2. I want to log Power usage (kW) (1.7.0) and the kWh (1.8.1 and 1.8.2) I want to put them in a chart.
Where do I find some help?

I’m still reading the documents. At the beginning it is suggested to use the UI Tutorial
Later on the the files are edited Items and I don’t find any documents based on the UI. Now I am a bit confused :thinking:

Hi, I’m a bit struggling as I don’t know you exact issue. But let’s try to shed in some light.

As you described yourself as a beginner, I suggest you start with the UI and not with item files.

Just follow the UI guides mentioned here in the table of content. I would suggest the links to Adding Things: Simple and Items and the Semantic Model.

Maybe you can also describe what you have done so far and what your issue is?

Cheers
thefechner

I got openHAB running yesterday. I’m using openhabian on a raspberry 3b. So I’m a beginner at openHAB.
I created a thing smartmeter and got it running. Then I tried to create an item in order to link it with channel of the smartmeter.


But it slows no data, only NULL :sob:
Type is Number:Energy. Where do I put the unit? And why is no data shown? The thing smartmeter seems to work. At http://openhabiandevice:9001/?filter=1-0%3A1.8.2 are data’s. If I have to do the rest of the config of the item in a file, I’ll do that. I’m able to use nano :wink:

Hi again, I guess item-files won’t help us here. I assume the issue is somewhere in the item types.

As you have already the THING running, you can use the built-in item creation function. That will make sure, all item/point types are correct and derived from the THING channel.

Go into the THING and scroll to the end. There you can generate equipment and points. Both are at the end items with special semantic tagging. But that’s not so important for now.

e.g. “Add equip. to Model” -> Scroll down to channels and select one or more -> “Add to model”
Don’t change any of predefined entries. Just leave it to OH. You can redo / adjust later.


What happened? Any success? Any values?

Cheers
Steffen

1 Like

Success :+1: :smiley:

I made an entire in model: Energy centre
Then I added a equipment with the link in channels in the thing.
Now there are values in the items.
Next is to put everything together in a chart. I have to reed the docs :wink: to proceed.

Finally :slight_smile: … Great … Good luck :slight_smile:

thefechner

I noticed now, the the actual power consumption 10 times to low is. Is there any easy way to correct this at the connection between the channel and the item?

First of all make sure your observation is in fact correct. Then you need to watch it over time. Is it always 10 time too low or does it vary? Is it really 10 times too low or is the units it’s showing different from what you expect? Maybe it’s showing a Ws instead of a Wh. What units does it show by default?

Assuming that it is always a fixed number too low, there is an offset profile (Items | openHAB) that allows you to add a constant to the value pushed by the Channel before it gets to the Item.

If it’s a constant 10 times too low you can apply a tranformation profile and you can run the value through a JavaScript function to multiply it by 10 before it gets to the Item. You could also use a Rule to multiply the raw value and update a proxy Item with the “real” value.

Today I got the invoice of my power consumption.
Every meter reading has to be multiplied by 30 to get the correct values.
So how do I do this with java. Is there a possibility to apply a correction to the saved values?

It feels like every tutorial is for version 2 and nothing I need is for OH3 :roll_eyes:
Is there a way to use the code of the examples in OH3. Where are the files to edit or do I get inconsistencies if I edit them directly?

Create a JavaScript transformation to multiple the value by 30.

http://www.openhab.org/addons/transformations/javascript/

If the binding supports it, apply this transformation. If it doesn’t apply it as a transform profile.

Or you can create a proxy Item and a rule to multiply changes to the Item linked to the sensor by 30 and forwarding that result to the proxy Item.

Yes, just about everything that applies to OH 2 also applies to OH 3. But you have to do it the same way. So if you see an example with .rules files examples, you have to save those to a rules file. you can’t just copy them into the UI. The location to put all the various file types are in the docs. For example, the rules docs state:

Rules are placed in the folder $OPENHAB_CONF/rules .

$OPENHAB_CONF is a variable that depends on how you installed openHAB. For Linux you can find the mapping at openHAB on Linux | openHAB

After some testing I createt a JavaScript transformation.
I’m using this code in a file:

zaehlerfaktor.js
(function(i)
{ return i’
'30;
})(input)

But at http://openhabiandevice:9001/ I got an error:
Could not transform state ‘0.731 kW’ with function ‘zaehlerfaktor.js’ and format '%s

Do I have to put something in ‘State Formatter’ to get it working?

But there my be another issue: I’m from Germany, and we use “,” as decimal separator. OpenHABian is configured to use this format. As you can see, my smartmeter uses the english format “.” as decimal separator.
While I’m writing this post, I noticed I haven’t set the locals, so my raspberry runs with english settings. I thing if I change this now, I’ll get the next problem. But I want to use the germen setting in future. What are my options to transform the english values to german?