added sml
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
rule "EHZ"
|
||||
when
|
||||
Time cron "0,30 */1 * * * ?" // this one cycles every 30 seconds. depends on your needs
|
||||
then
|
||||
// getting the payload of the meter
|
||||
var String meter_payload = executeCommandLine("/home/openhabian/src/libsml/examples/sml_server /dev/ttyUSB0", 5000) // note the argument /dev/ttyUSB0 - 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')
|
||||
val counterStr = lines.get(0).split('#').get(1)
|
||||
val consumptionStr = lines.get(2).split('#').get(1)
|
||||
// Updating the items
|
||||
if (EHZ_status_power.state != counterStr) EHZ_status_power.sendCommand(counterStr)
|
||||
EHZ_consumption_power.postUpdate(consumptionStr)
|
||||
end
|
||||
Reference in New Issue
Block a user