ZigBee consecutive polling of Attributes

Hi all,

I bought some Zigbee Devices like the TS011F Smart Plug and the TS130F Rollershutter.
Some of the Attributes are not supported for reoporting like electical measurement.
Is there any way in the ZigBee console or somewhere else to configure consecutive polling? Currently I do it by executing every minute a command in the OH Console trough a rule.
I wonder if there is a better way.

Thanks a lot and have a good weekend
/Franz

var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.poll');
var Exec = Java.type('org.openhab.core.model.script.actions.Exec');
var command = Exec.executeCommandLine;
var result = "";

result = sendConsole("zigbee read 13331/1 0x0B04 1291");
result = sendConsole("zigbee read 16695/1 0x0B04 1291");
result = sendConsole("zigbee read 29159/1 0x0B04 1291");
result = sendConsole("zigbee read 31132/1 0x0B04 1291");
result = sendConsole("zigbee read 46811/1 0x0B04 1291");
result = sendConsole("zigbee read 55589/1 0x0B04 1291");

logger.info(result);

function sendConsole(commandForConsole)
{
  logger.info(commandForConsole);
  return results = Exec.executeCommandLine("/openhab/runtime/bin/client", "-p" , "habopen" , commandForConsole);
}

The binding should periodically poll the device itself, so you shouldn’t need to do this. If the polling and reporting options aren’t available for this channel, then please raise an issue on the github issues list and I’ll look at adding it.

Has a github issue been raised for this? I also have the TS011F smart plug and seems like support for it isn’t ideal at the moment.

Hi
yes I’ve created this item:

@phjr99 its sometimes a bit weired because one adapter in my case reports really the others need to be polled (same model).

Hi @phjr99 ,
you might also try

configuration: {}
triggers:
  - id: "2"
    configuration:
      cronExpression: 0 * * * * ? *
    type: timer.GenericCronTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      blockSource: <xml
        xmlns="https://developers.google.com/blockly/xml"><variables><variable
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</variable><variable
        id=".G~kif+tZ09MK`0fZjEj">DeviceIDName</variable><variable
        id="u?,MpklY8J),ODnLKwQX">commandForConsole</variable><variable
        id="i`|XL,8A10e*=daT)ue|">ZigAddy</variable><variable
        id=";u$Y0ajQSlejJNC~-*Qn">RetArr</variable></variables><block
        type="variables_set" id="iYDc}R=_BbP%OqJ)*]C3" x="397" y="134"><field
        name="VAR" id="V05[fkbH(c#/1ZlMIqBg">commandscript</field><value
        name="VALUE"><block type="text" id="kql%I9HpZm)09HcT:HC4"><field
        name="TEXT"></field></block></value><next><block type="controls_forEach"
        id="(/d9,:T/mjNS={A``1.B"><field name="VAR"
        id="i`|XL,8A10e*=daT)ue|">ZigAddy</field><value name="LIST"><block
        type="procedures_callreturn" id="WJ=EelY`!(OnkT/j;4m["><mutation
        name="ZigbeeNetworkAderesses"><arg
        name="DeviceIDName"></arg></mutation><value name="ARG0"><block
        type="text" id="2xxM=A,zD4{(#,:mH{ps"><field
        name="TEXT">TS011F</field></block></value></block></value><statement
        name="DO"><block type="variables_set" id="BXCTSJi^~M#~.Ry6]sD]"><field
        name="VAR" id="V05[fkbH(c#/1ZlMIqBg">commandscript</field><value
        name="VALUE"><block type="text_join" id="~.tvIt1/aU2JNZ{^hk2h"><mutation
        items="5"></mutation><value name="ADD0"><block type="variables_get"
        id="MAg87u,KK^=PS{7rk]Bv"><field name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field></block></value><value
        name="ADD1"><block type="text" id="el7W54z+ymS{*4H)#ca/"><field
        name="TEXT">zigbee read </field></block></value><value
        name="ADD2"><block type="variables_get" id="PW9$%+qbB4!TTyopuw83"><field
        name="VAR"
        id="i`|XL,8A10e*=daT)ue|">ZigAddy</field></block></value><value
        name="ADD3"><block type="text" id="X!9^E7E$k34f/hT-8mi!"><field
        name="TEXT">/1 0x0B04 1291</field></block></value><value
        name="ADD4"><block type="oh_text_crlf"
        id="[u2%@sscSk*URO+USNZU"></block></value></block></value><next><block
        type="variables_set" id="T4J7-BcPaY8nXN6=@g1!"><field name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field><value
        name="VALUE"><block type="text_join" id="?yJmYw4zJ!}0A$}/=^Yy"><mutation
        items="3"></mutation><value name="ADD0"><block type="variables_get"
        id="h.7hZ,/8([*Nj5jMrtkD"><field name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field></block></value><value
        name="ADD1"><block type="text" id="Sh(~Z`ev^?2~%[ca/uGK"><field
        name="TEXT">sleep 1</field></block></value><value name="ADD2"><block
        type="oh_text_crlf"
        id="^}+G8GS_iU}jH.Fj|HEE"></block></value></block></value><next><block
        type="variables_set" id=",=T/1)~CeM{(Y84.Q9bN"><field name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field><value
        name="VALUE"><block type="text_join" id="I:^LG:i:[uz1I,2r6JJ*"><mutation
        items="5"></mutation><value name="ADD0"><block type="variables_get"
        id="U([RyKc6nQ;,D_EK6m]~"><field name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field></block></value><value
        name="ADD1"><block type="text" id="HBf5s*4{rD`EK{=5;g|_"><field
        name="TEXT">zigbee read </field></block></value><value
        name="ADD2"><block type="variables_get" id="FrGb4b;``0h)/{RgcS0O"><field
        name="VAR"
        id="i`|XL,8A10e*=daT)ue|">ZigAddy</field></block></value><value
        name="ADD3"><block type="text" id="jikuGS8Blo{G-|Cew=a}"><field
        name="TEXT">/1 0x0702 0</field></block></value><value name="ADD4"><block
        type="oh_text_crlf"
        id="![~P`NchYQ+8${_HHhuQ"></block></value></block></value><next><block
        type="variables_set" id="oI,c:1H43Pb_xfrqE.;="><field name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field><value
        name="VALUE"><block type="text_join" id="ru|yOMOD,`(w$pXgsR.}"><mutation
        items="3"></mutation><value name="ADD0"><block type="variables_get"
        id="AX`F)*tI9dCwNU/P5D{:"><field name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field></block></value><value
        name="ADD1"><block type="text" id="WW#xDFxq_XOqFZgC@-ip"><field
        name="TEXT">sleep 1</field></block></value><value name="ADD2"><block
        type="oh_text_crlf"
        id="Tf5@FAAj}Fe.YNDT`JxG"></block></value></block></value></block></next></block></next></block></next></block></statement><next><block
        type="procedures_callnoreturn" id="3e0:,Uu}l[iqL}V|.vO_"><mutation
        name="sendConsole"><arg name="commandForConsole"></arg></mutation><value
        name="ARG0"><block type="variables_get" id="Y*+|V4ryv_Y}W+Q.pMwE"><field
        name="VAR"
        id="V05[fkbH(c#/1ZlMIqBg">commandscript</field></block></value><next><block
        type="oh_log" id="Z[s8stwQ6ru^@-40:Z7q" disabled="true"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="^@@)1v},7:[ned0tP]7$"><field
        name="TEXT">ende</field></shadow></value></block></next></block></next></block></next></block><block
        type="procedures_defreturn" id="iAOc2(mmg~UEzf1/sR@M" x="389"
        y="809"><mutation><arg name="DeviceIDName"
        varid=".G~kif+tZ09MK`0fZjEj"></arg></mutation><field
        name="NAME">ZigbeeNetworkAderesses</field><comment pinned="false" h="80"
        w="160">Describe this function...</comment><statement
        name="STACK"><block type="variables_set"
        id="?KE5eun]go9[LSE]vS~v"><field name="VAR"
        id=";u$Y0ajQSlejJNC~-*Qn">RetArr</field><value name="VALUE"><block
        type="lists_create_with" id="U`WBlP%ruM1)d/nc6PV7"><mutation
        items="0"></mutation></block></value><next><block
        type="oh_script_inline" id="iEtBv*IwJ(.#e:hUr-22"><field
        name="inlineScript">for each (var thing in
        things.getAll())&amp;#10;{&amp;#10;  if
        (thing.UID.toString().split(":")[0] ==
        "zigbee")&amp;#10;  {&amp;#10;    if (thing.properties.get("modelId") ==
        DeviceIDName)&amp;#10;      {&amp;#10;        RetArr.push(thing.properties.get("zigbee_networkaddress"));&amp;#10;      }&amp;#10;  }  &amp;#10;}</field></block></next></block></statement><value
        name="RETURN"><block type="variables_get"
        id="RklJ}O.7Q|4Ngr6dW|]$"><field name="VAR"
        id=";u$Y0ajQSlejJNC~-*Qn">RetArr</field></block></value></block><block
        type="procedures_defnoreturn" id="LDsJYDUGFJA2KUke?@B:" x="392"
        y="1178"><mutation><arg name="commandForConsole"
        varid="u?,MpklY8J),ODnLKwQX"></arg></mutation><field
        name="NAME">sendConsole</field><comment pinned="false" h="80"
        w="160">Describe this function...</comment><statement
        name="STACK"><block type="oh_log" id="+yQv]uG2P;dNN!rBnSXv"
        disabled="true"><field name="severity">info</field><value
        name="message"><shadow type="text" id="MkMV}F2d56)qZAFV-w9K"><field
        name="TEXT">(commandForConsole</field></shadow><block
        type="variables_get" id="q%+G,6?]%u.M=^)b$BHt"><field name="VAR"
        id="u?,MpklY8J),ODnLKwQX">commandForConsole</field></block></value><next><block
        type="oh_script_inline" id="N,z}TgOy:I,1lsaEPW0t"><field
        name="inlineScript">var Exec =
        Java.type('org.openhab.core.model.script.actions.Exec');&amp;#10;return
        results = Exec.executeCommandLine("/openhab/runtime/bin/client", "-p" ,
        "habopen" ,
        commandForConsole);</field></block></next></block></statement></block></xml>
      type: application/javascript
      script: >
        var commandscript, DeviceIDName, commandForConsole, ZigAddy, RetArr;


        // Describe this function...

        function ZigbeeNetworkAderesses(DeviceIDName) {
          RetArr = [];
          for each (var thing in things.getAll())
          {
            if (thing.UID.toString().split(":")[0] == "zigbee")
            {
              if (thing.properties.get("modelId") == DeviceIDName)
                {
                  RetArr.push(thing.properties.get("zigbee_networkaddress"));
                }
            }
          }
          return RetArr;
        }


        // Describe this function...

        function sendConsole(commandForConsole) {
          var Exec = Java.type('org.openhab.core.model.script.actions.Exec');
          return results = Exec.executeCommandLine("/openhab/runtime/bin/client", "-p" , "habopen" , commandForConsole);
        }



        commandscript = '';

        var ZigAddy_list = ZigbeeNetworkAderesses('TS011F');

        for (var ZigAddy_index in ZigAddy_list) {
          ZigAddy = ZigAddy_list[ZigAddy_index];
          commandscript = [commandscript,'zigbee read ',ZigAddy,'/1 0x0B04 1291','\r\n'].join('');
          commandscript = [commandscript,'sleep 1','\r\n'].join('');
          commandscript = [commandscript,'zigbee read ',ZigAddy,'/1 0x0702 0','\r\n'].join('');
          commandscript = [commandscript,'sleep 1','\r\n'].join('');
        }

        sendConsole(commandscript);
    type: script.ScriptAction

Can you describe what the problem is? What exactly is missing.

This issue is about allowing the user to change the reporting rather than using the default values used by the binding. It’s unclear if this is the issue that @phjr99 is having since even without the user being able to control the reporting, the channel data should still be available, and this issue won’t really change that.

Maybe the device didn’t get configured correclty during initialisation. You could try to reinitialise it - there is an option in the configuration of the device to do this.

It’s a pity this discussion picked up its pace only now. In the mean time I have found a different solution for zigbee interfacing, as openhab seemed quite lacking (I use zigbee2mqtt now). However if I remember correctly, the problem with TS011F was that the binding wasn’t reporting the measurements (current/watts/voltage/…) - most likely due to missing polling, but could be something else.

Apologies - I’ve personally been travelling extensively since the beginning of August in Africa, the US and Europe, and have only returned home on Tuesday. I have had limited time to work on openHAB issues during this time - please remember that this is not my main job.

Generally polling should not be required if the device supports the standard reporting system from Zigbee. The binding should configure reporting on all channels if supported, and if not, it should poll. Without seeing logs though, it’s hard to say what is happening with this device.

No need to apologize, I didn’t mean to put any blame on you or anyone else - I’m well aware this is a volunteer project and noone’s main job.

Indeed many things shouldn’t be needed if devices followed the standards. All in all I see zigbee as much more fragmented than z-wave, with many vendors implementing their own interpretations of standards, or just not following the standards fully. Thus my choice of zigbee2mqtt, which seems to be following these things quite quickly and has a huge database of these “quirks” for specific devices.

1 Like