Comments (9)
I would have appreciated openhab proposing changes here.
from libsml.
smartmeter-obis got such switch just recently. i would recommend everyone developing on libsml should have a look at that lib - just to have something to compare with
from libsml.
Thank you for the new issue and that you are willing to include the needs of the openHAB people into libsml.
I just checked. In my case the unmodified sml_server produces the following output, which also loops:
SML file (3 SML messages, 316 bytes)
SML message 101
SML message 701
SML message 201
OBIS data
129-129:199.130.3*255#EMH#
1-0:0.0.9*255#06 45 4d 48 01 0b c1 a5 e7 2b #
1-0:1.8.0*255#20355093.1#Wh
1-0:1.8.1*255#20355093.1#Wh
1-0:1.8.2*255#0.0#Wh
1-0:16.7.0*255#592.3#W
129-129:199.130.5*255#T04 77 07 9e 79 9f 7c 4d 74 45 e0 b8 6b 6c fd 50 88 8a ab 9a 3a 5b 05 b8 4b fa d3 24 e1 f4 70 d1 30 39 e1 a4 93 23 18 9a 24 ec 3b ec c1 83 15 #
The modified sml_server produces the following output and then exists:
1-0:1.8.0*255#20234.615#
1-0:1.8.1*255#20234.615#
1-0:16.7.0*255#1.081#
So it it not just about a switch to terminate sml_server after a single run.
What I do not know exactly as my knowledge about Java (which is used for openHAB and also the linked rule) is basic: Does the unmodified sml_server output work? I would say no as it looks into all lines and makes something. Sorry that I cannot be more clear on that as I am really not a programmer...
from libsml.
No, it will not work as it is. The rule just takes line 0 and 2, which won't work on all meters today. It needs to parse the lines it reads for 1.8.0 and 16.7.0. This should be quite simple.
from libsml.
I made a branch which includes the -s. Please check, if this works. sml_server_switch
Please keep in mind that you still need to add a message parsing in the rule. This can not be done by sml_server.
from libsml.
@msebald Did you have time to test my code?
I tried to change your rule to parse the object names:
// getting the payload of the meter
var String meter_payload = executeCommandLine("/home/openhabian/volkszaehler/libsml/examples/sml_server -s /dev/ttyUSB0", 5000) // note the argument /dev/ttyUSB0 or /dev/sml0 - your meter-device-id goes here
// splitting the payload - first in lines, then getting counterStr and consumptionStr with delimiter "#"
val lines = meter_payload.split('\n')
for (String line : lines) {
if (line != null) {
// split the line separated into object name and value
var lineStr = line.split('#')
var obj_name = lineStr.get(0)
var value = lineStr.get(1)
if (obj_name == "1-0:1.8.0*255") {
if (EHZ_status_power.state != value)
EHZ_status_power.sendCommand(value)
} else if (obj_name == "1-0:16.7.0*255") {
EHZ_consumption_power.postUpdate(value)
}
}
}
But be aware. I am not familiar in writing Xtend code and have not tested it with openHAB.
from libsml.
No. But I will. I'm on vacation. Next week I'm back home again.
from libsml.
@msebald Have you had a chance to test the code and the modified parsing? Just saw that this issue is still open.
from libsml.
No answer from @msebald. But as I created a pull request, I'll close this.
from libsml.
Related Issues (20)
- Unsigned current Power Value HOT 9
- timeout HOT 6
- libsml crc enhancements ? HOT 10
- DZG workaround not necessary anymore HOT 20
- Add support for efr SGM-C4 meter
- sml_server does not decode testfile from eBZ DD3 2R06 HOT 2
- SML-Errors with Holley DTZ541 HOT 2
- hexdump() compatibility issue with newest Arduino / ESP8266 libraries HOT 8
- libsml debian package still points to dailab repo HOT 3
- Cannot Build on Raspberry Debian 11 with gcc version 10.2.1 HOT 2
- sml_server does not decode data from device DZMeteringGmbH_WS_7412.1 (negative values) HOT 15
- sml_server not part of libsml1 debian package HOT 7
- Odd readings from DWSB20.2TH: Display shows power -195W, vzlogger reports 460W HOT 15
- List of projects using libsml HOT 3
- How to use libsml in ESPhome? HOT 3
- deprecate / replace `sml_transport` API
- support arduino?
- DZG - libsml: error: unrecognized sequence HOT 8
- More Examples HOT 6
- Compile Error on Alpine: no member named '__jmpbuf' HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsml.