[SOLVED] The name 'knx_virtual_time' cannot be resolved to an item or type

Hi there,

I try to send a current time information into my KNX bus periodically. Therefore I setup a rule which fires periodically but my attempt to call “sendCommand()” fails… :-/

  • Platform information:

    • Hardware:Raspberry Pi 3 B+
    • OS: openhabian
    • openHAB version: openHAB 2.4.0-1 (Release Build)
  • Issue of the topic:
    My rule is fired as expected but the execution fails because the thing I want to fire the command on cannot be found.

  • Please post configurations (if applicable):

    • Items configuration related to the issue
Thing device knx_virtual "knx-virtual" {
    Type datetime-control : time "knx_virtual_time" [ ga="10.001:8/2/0" ]
  • Rules code related to the issue
rule "Send time to KNX bus"
  Time cron "4 0/1 * ? * * *"
  • If logs where generated please post these here using code fences:
[ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Send time to KNX bus': The name 'knx_virtual_time' cannot be resolved to an item or type; line 5, column 3, length 16

I can’t see why the system complains… please open my eyes!

Thanks in advance!

kind regards


Looking in the official documentation, it looks like knx_virtual_time is not defined by the binding or by you.

Hi Bruce,

thanks for your advice! I’m at that point where I’ve read and used the documentation (the KNX binding in special) for many times successfully. I’m unable to see where I missed something.
I’ll try to get more specific with my question:

The error message complains about “knx_virtual_time” because I referenced it with the rules ‘then’ code block.
I tried different namings for the reference all built from the words of the thing description:

  • knx_virtual:time failed due to parse error when reading the rule file (because of character ‘:’).
  • knx_virtual same error message as above
  • knx-virtual fails
  • knx_virtual_time fails
    …you name it…
    Nothing worked so far.

Could you please give me a sample description that would make my code work?

Thanks you!


You’ve defined a KNX thing.
As the error says, the rule is looking for an Item (or variable).

You will almost always need to create an Item and link it to one of your thing’s channels to use in rules and UI.

1 Like
Thing device knx_virtual "knx-virtual" {
    Type datetime-control : time "knx_virtual_time" [ ga="10.001:8/2/0" ]

This is a channel. Please be aware that the channel is named time, not knx_virtual_time.
You have to link the channel to an item for using it in a rule.

As it’s to send time to knx: Please take a look at his:

// Time and Date
Thing ntp:ntp:home "Lokale Zeit" [hostname="0.pool.ntp.org",refresh=120, refreshNtp=30, locale="de_DE", timeZone="Europe/Berlin"]

// knx
Bridge knx:ip:bridge "Weinzierl 730 IP" [ 
 ] {
   Thing device Virtuell "virtuelle" @ "KNX" [ 
     ] {
        Type datetime-control : wochenzeit "Zeit und Tag" [ ga="10.001:15/7/10" ]
DateTime Buszeit "Zeit und Tag" { channel="knx:device:bridge:Virtuell:wochenzeit", channel="ntp:ntp:home:dateTime" }

No rule, the above configuration is sufficient to update the bus time for knx

EDIT: You’ll only need knx and ntp binding :slight_smile:


:man_facepalming: That was my fault, I weren’t able get that in the late evening. o_0

Absolute! I just wrote it that way to show how many variants I tried…

I had and it looks promising good! So I tried it out. Unfortunately some questions came up that I wasn’t able to answer myself:

  • Just to be sure, this is code from the *.things file, isn’t it?
  • The Thing ntp:ntp:home [...] resides in the “root” of the file?
  • The Thing device Virtuell "virtuelle" @ "KNX" [...] is part of my Bridge knx:ip:bridge [...]?

This goes to a *.items file, correct?

At least I did it that way with no success. When I save the files the log shows changes detection indications. While the system is running I cannot see any KNX telegrams on the KNX bus which I trace using ETS Pro version nor any log entries which indicate the new cofiguration is working properly.

Any ideas? About that? Are you running the config shown on openHAB 2.4?

Yes, doesn’t matter and yes :slight_smile:

It doesn’t matter where you put the thing definition in, e.g. I have different *.things files for that, one knx.things for all knx devices, one mqtt.things for all mqtt devices, a my.things file for all that stuff which is configured in one or two lines (as ntp), that’s up to you. The file name doesn’t matter as long as it ends with .things and is stored in ./things/

You have to setup the correct group address :slight_smile: in the channel, and you have to install the ntp binding :wink: in addition to knx, obviously.

Correct :slight_smile:

Please take care about the channel, as it depends on your bridge, thing and channel definition. That’s why I posted my bridge…

As you are using files to define things, please be aware that (especially when changing things) you maybe have to restart the corresponding bundle, i.e. typing on the karaf console:

openhab> bundle:restart org.openhab.binding.knx

or simply restart openHAB completely (which takes ages compared to bundle:restart).

1 Like

Yes, you made my day! Installing the NTP binding that was missing before did the trick. It works like a charm now, the bus is updated with a time stamp once in a while so all the display devices show the corret time now. (Without that they run out of sync after a month…)
Would you please add a hint to install NTP binding in addition to your posting so all the other folks that come here will find a complete solution.
Again: Thank you so much! That was a pretty good advice.

1 Like