Newcomer in need of rule help / explanation

I have got OpenHAB running in a Pi VM (only 2 days in) and have auto discovered my devices and even created a Dashboard. I have a selection of items like hue lights, Weemo plugs etc. I can not work out the rules system. I am working with auto generated Item names and would like to make a Pushover notification happen when the TV mutes (for testing) the Pushover works on a rule for system boot.

What am i doing wrong? I have tried the rules engine and the HABmin but can not get this right.

rule “Testing TV”
item “lgwebos:WebOSTV:c4cc2087-adf0-4a88-86d0-7446e7666be1:volume” changed from OFF to ON
pushover(“Testing Push”, 1, " Testing","", “none”)

How should I look at the items names? If I wanted to change a hue bulbs colour for example, that sort of thing. Thanks in advance

Hi there,
Could you state your problem?

I have changed the initial post above :slight_smile:

is not an item, it’s a thing’s channel

You need to create an item in an *.items file

Switch TestVolume {channel= “lgwebos:WebOSTV:c4cc2087-adf0-4a88-86d0-7446e7666be1:volume” }

Then your rule:

rule “Testing TV”
    Item TestVolume changed from OFF to ON
    pushover(“Testing Pish”, 1, " Testing","", “none”)

Thanks for replying, will go try this out now - am I going to have to create an items file for every device? Does the auto discovery of items not offer rule usage for you? I have added lots of switches and dimmers etc into a dashboard, is that not the same use?

You can use the item names given to you by the paperUI if you want.
I recommend that you familarize yourself with item fiels as some binding cannot be configured through the paperUI.
You can put as many items as you want in an items file. I have one with about 150 items in it.
Do NOT confuse items and things. Things get auto discovered. Then you have added items liked to the things channels through a binding in a UI

I dont mean to be daft / rude / stupid but then why do i need to make an items file? I genuinely dont get it!

For example, if you use a binding that doesn’t autodiscover things like the exec binding or the mqtt binding then you HAVE to create an item manually in an items file.
The paperUI will give you the name of the item liked to your channels. You can use those items in your rules.
What is the name of the item liked to the channel above? lgwebos:WebOSTV:c4cc2087-adf0-4a88-86d0-7446e7666be1:volume

The you can use that name in a rule.
It’s a TV volume so I think it’s a Number item that accepts numeric values not ON and OFF

I was using mute not volume, my copy/paste mistake therefore On OFF should be good. With the items file in play (no pushing working) the Control Thing named SmartTV disappeared in PaperUI (even after a service restart) so removed the items file and it is back. So if I was to use the auto discovered name would my original rule posting be correct (minus the volume typo error)?

When i expand the TV under Configuration > Things > SmartTV there are many channels and mute appears as:

On that screen, you can link the channel to an Item. You can let openHAB name the item for you or you can make up your own. Once you have that item name, you can use that in rules.

Have you been through the tutorials?

Yes I have, the rules section multiple times! So I just added my phone as a network ping able device and then clicked the copy icon next to the enabled radio button on the phones Online channel. Then added a rule as follows:
rule “My Phone”
item “network:pingdevice:e8d5d9eb:online” changed from OFF to ON
pushover(“Phone State”, 1, “My phone changed”, “”, “none”)

I also added the device as an item file as:
switch presence_mobile_me “My Mobile” { channel=“network:device:” }
and created a rule as above but used
Item presence_mobile_me changed from OFF to ON

And nothing happens when phone state changes!

You can’t use item “network:pingdevice:e8d5d9eb:online” as I said above it’s a thing not an item.
The syntax in rules is Item not item

What does your log show?
Can you see the item changing in the log?

I have no idea how to access the log info im afraid, I also am a Windows server man with little Linux knoweldge.

I appreciate your time in helping me with this.

Sorry I left windows for linux 3 years ago and never looked back.

Anyone with openHAB on windows experience help this young man with the logs, please?

How did you install oh in your VM?

So I found the log files and could see it wouldnt load the rule due to no viable alternative at input ‘Item’.
Took out the non items file referenced line and it seems to have loaded it in now, well no error in log. However still no push notification when phone goes on or off the network.

I spun up a new VM in hyper-v to get raspberry pi desktop running it, dont like running services on the tin box.

You should see on the logs when the phone goes on and off the network.
item presence_mobile changed to ON

Have you given a fixed IP to your phone?

Add a logInfo("TEST","Presence Mobile") in your rule
this way you can see in the log if the rule has fired
If it fires then you have a problem with your notification and we’ll solve that next

To confirm so far. I have a Phones.items file that has
switch presence_mobile_me “My Mobile” { channel=“network:pingdevice:e8d5d9eb:online” } (note that I changed this line from being an IP address as couldnt see anything in logs for the IP also put it back to IP and not made any difference.)

I have a phones.rules file
Rule “My Phone”
Item presence_mobile_me changed from ON to OFF
Loginfo(“Phones.rules”, “Presence Mobile”)
pushover(“Phones Presence Push”,1,“My Phone Off LAN”, “”, “none”)

The last line in the log shows Refreshing model ‘Phones.rules’ whereas before it was complaining about errors in rule file. My phone has a static IP and I have lowered the response to 10 seconds.

Nothing in the log file and not push notifications however I do get a push notification when OpenHAB starts up.

You need to look at the other log