This page last changed on Feb 13, 2015 by bart groot.

I am experimenting with a eminent em6600 z wave energy reader.
I an able to read how many times the wheel from the KWH meter spins in 15 minutes.
The meter i have does 345 rounds when 1 KWH is used.

So to display the KWH used instead of the amount of rounds from the meter i have to devide the reading by 345 and multiply by 1000. i should probably also do a decimal rounding to 1 decimal.

i read an article on how to convert values by a rule but i dont really understand how to modify this for my energy meter.

this is the article;

Can anyone explain to me howthe rule should be for my simple conversion?

After some long nights struggling with the wrong java version i now have a working rule.
I also tried to make the rule calculatie the used Watts bij substracting the last reading by the previous reading but that does not really work.
Here's my rule upto now,

package org.openremote.controller.protocol;
global org.openremote.controller.statuscache.CommandFacade execute;

// For logger
import org.openremote.controller.utils.Logger;
import org.openremote.controller.Constants;
import org.openremote.controller.model.event.*
// For logger

function void log(String msg)
  Logger.getLogger(Constants.RUNTIME_EVENTPROCESSOR_LOG_CATEGORY + ".drools").debug(msg);

rule  "heartbeat_every_7_minutes" 
   timer (int: 0s 7m)  when eval  (true) then
   execute.command ("Pulsen");
   execute.command ("batterij");

rule "Totaal Verbruik"
   $evt : Event (source=="Pulsen")
    $oldevt : Event (source=="meterstand")
  double correctedValue = Double.parseDouble($evt.getValue().toString())/375;
  double oldValue = Double.parseDouble($oldevt.getValue().toString());
  double realtimeWatts = (correctedValue - oldValue)*4;
  execute.command("KWh",  String.format("%.2f",correctedValue));
  execute.command("Watt",  String.format("%.2f",realtimeWatts));

Posted by bart groot at Feb 11, 2015 08:00
Document generated by Confluence on Jun 05, 2016 09:35