Creating Zigbee Device Thing

Hello

Created this thing: Thing zigbee:device:609d239b:d0cf5efffeea0ef6 “Bombilla” [zigbee_macaddress=“D0CF5EFFFEEA0EF6”]

Status is unkown. If i do it by discovery on paperUI it works perfect. I’m missing something I guess?

Can’t I use channel things I created through PaperUI so I can set some rules with them

You appear to need to review or re-review https://www.openhab.org/docs/concepts/ and pay attention to the difference between a Thing and an Item.

  • The syntax posted appears to be Item syntax, not Thing syntax.
  • If you are successfully autodiscovering the Things, why are you trying to redefine them?
  • You don’t say where you are saving that text to.

Of course. Create an Item and link the Channel to the Item. You can use the Item in your Rules and such.

1 Like

I will re read the basic concepts. Just I saw my autodiscovered bulb on “things” tab and I went just straight for it.

I just thought I need to redefined them to use it through configuration files. But it seems internal database and configuration files work together.

So I have both color temperatura and level control channels linked to items made on PaperUI, now I just create some rule with them? Or do I have to create those items through configuration files?

You only use one or the other. Never define the same Thing or Item in both ways.

So let’s see if I understand. I created everything on PaperUI. The thing is called bulb with channel color_temperature and switch_dimmer linked respectively to Temperature and Dimmer items.

So now I could just create a rule like:

when system Started
then
item Temperature = 50
end

Just like that?

Don’ forget code fences in your posts!

rule "Test rule"
when 
    System started
then
    Temperature.sendCommand(50)
end

Not quite. For one, you can’t name an Item Dimmer because “Dimmer” is a reserved word.

Your Rule is missing the starting rule "name of my rule".

You have to sendCommand or postUpdate to change the state of an Item. See https://www.openhab.org/docs/configuration/rules-dsl.html

Well I did as both of you advised. The items weren’t actually like that, they are the spanish version of it so no problem about that.

I just rebooted openhab and nothing happened. I’ll do more tests and learning tomorrow, I’ll try to make a rule like “when Temperature.status(or whatever argument) > 50” then sendCommand(50)"*. That way I can test properly since when I reboot the zigbee device takes a while to get online and the rule might be not executed on time.

Thanks both for the help!

You don’t have to reboot the machine it restart openHAB to run the rule. Just save the file or user the touch command and the file will release and the role will trigger.

You cannot trigger a rule with a comparison like >. You have to do that in the Rule.

Yeah with reboot I meant that. I restarted openhab service, the rule didn’t execute.

Tried this rule:

rule "Test rule"
when 
    Item Temperatura received command
then
    Temperatura.sendCommand(50)
end

2019-11-13 18:54:33.292 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘normas.rules’

==> /var/log/openhab2/events.log <==

2019-11-13 18:54:40.563 [ome.event.ItemCommandEvent] - Item ‘IKEAOfSwedenTRADFRIBulbGU10WS400lm_ColorTemperature’ received command 26

Log shows that, it get stucks on “loading model normas.rules”. Seems like rule is not loading properly?

First, let’s consider what this Rule does. The Rule triggers when Temperatura receives a command. The Rule sends a command to Temperatura. The Rule triggers when Temperatura receives a command… and so on forever. You’ve created an infinite loop.

Add logging to the Rule to see if it is triggering. If you don’t see any errors in openhab.log after the “loading model” entry OH loaded the .rules file just fine.

I got it thanks… I was making a stupid mistake I’m ashamed to tell but proud to have discovered myself… facepalms
Rule working as expected, I have to keep learning :stuck_out_tongue:

Thank you very much!