Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. joseraj
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by joseraj

    • RE: Pulse Power Meter with OpenHAB?

      @mbj Thank you for testing.
      If Openhab discards the request without payload there is nothing to do on the gateway side.
      I don't know if other controllers deal with this. If others like Domoticz work without the V_VAR2 method then the work should be done on MQTT binding.
      Anyway the solution above still work for me.

      @TommySharp Have you tried the solution above?
      Just remember this rule works with "Pulse counts", you have to use the right "PULSE_FACTOR" on the controller to get the KWH.

      Provably you'll find another problem (only the first time):
      If the Item were you store the pulse count on Openhab (or any other controller) hasn't been initialized with some value, the controller shouldn't return any value. (just because it has none)
      When I did this sensor I solved sending a value with my cell through MyMQTT (android). This way you can keep sync the value on the controller and the value of the counter.
      In Openhab it can be initialized with a rule as explained here.

      posted in OpenHAB
      joseraj
      joseraj
    • RE: Pulse Power Meter with OpenHAB?

      Hi,

      The default sketch sends a request message :

        // Fetch last known pulse count value from gw
        gw.request(CHILD_ID, V_VAR1);
      

      I'm not able to make Openhab answer gw.request so I have used a rule:

      // This rule Send pulse count on request
      rule "Send On Request"
       when
       Item MyEnergy_Pulse_REQ received update
       then
         var Number Pc = MyEnergy_Pulse_count.state as DecimalType
         postUpdate(MyEnergy_Pulse_Restore, Pc)
      end
      

      I have defined the items:

      • Item to store the pulse counts. This is the info of interest for us.
      Number MyEnergy_Pulse_count
      
      • Auxiliary Item to receive the request (I don’t remember why I used a String type, but it works)
      String MyEnergy_Pulse_REQ
      
      • Auxiliary Item to restore the value to the node
      Number MyEnergy_Pulse_Restore
      

      How to setup the Items depends on the binding you use (I use MQTT)

      On the Node sketch I've used at the beginning:

      MyMessage pcReqMsg(CHILD_ID,V_VAR2);
      

      and on "void setup()" and void loop() replaced

      gw.request(CHILD_ID, V_VAR1);
      

      with

        gw.send(pcReqMsg.set("REQ"));
      

      REQ can be any text, as the rule only takes count of the update, not the value.

      How it works:
      Node sends "REQ" to Openhab as V_VAR2
      The rule detects the update (not a change) on Item MyEnergy_Pulse_REQ
      The rule returns the last value on Item MyEnergy_Pulse_count trough MyEnergy_Pulse_Restore on V_VAR1

      If someone can tell us how to make gw.request work with Openhab, ill be happy to remove this rule from the controller.

      posted in OpenHAB
      joseraj
      joseraj