项目作者: ddtlabs

项目描述 :
FHEM helper modul
高级语言: Perl
项目地址: git://github.com/ddtlabs/expandJSON.git
创建时间: 2017-02-21T07:28:09Z
项目社区:https://github.com/ddtlabs/expandJSON

开源协议:Other

下载


expandJSON v1.12 (w/ experimental array decoding)


    Expand a JSON string from a reading into individual readings




    • Requirement: perl module JSON

      Use “cpan install JSON” or operating system’s package manager to install
      Perl JSON Modul. Depending on your os the required package is named:
      libjson-perl or perl-JSON.




    Define




      define expandJSON
      []







    • A name of your choice.






    • Regexp that must match your devices, readings and values that contain
      the JSON strings. Regexp syntax is the same as used by notify and must not
      contain a space.







    • Optional: This regexp is used to determine whether the target reading is
      converted or not at all. If not set then all readings will be used. If set
      then only matching readings will be used. Regexp syntax is the same as
      used by notify and must not contain a space.





    • Examples:



      Source reading:

      device:reading:.{.}

      .
      WifiIOT.:sensor.:.{.}

      sonoff_.
      :.:.{.}

      dev.:(sensor1|sensor2|teleme.):.{.}

      (dev.
      |[Dd]evice.):json:.{.}

      (devX:jsonX:.{.}|devY.:jsonY:.{.Wifi.{.SSID.}.})




      Target reading:

      .
      power.

      (Current|Voltage|Wifi.
      )




      Complete definitions:

      define ej1 expandJSON device:sourceReading:.{.} targetReading

      define ej3 expandJSON .
      .SEN..:.:.{.}

      define ej3 expandJSON sonoff_.
      :sensor.:.{.} (power.*|current|voltage)





    Set



      N/A


    Get



      N/A


    Attributes



    • addReadingsPrefix

      Add source reading as prefix to new generated readings. Useful if you have
      more than one reading with a JSON string that should be converted.

      1. <li><b>disable</b><br>
      2. Used to disable this device.
      3. </li><br>
      4. <li><b>do_not_notify</b><br>
      5. Do not generate events for converted readings at all. Think twice before
      6. using this attribute. In most cases, it is more appropriate to use
      7. event-on-change-reading in target devices.
      8. </li><br>
      9. <li><b>disabledForIntervals</b></li>
      10. <li><b>addStateEvent</b></li>