[SOLVED] I followed the doc "Creating a sitemap", but icon is grey, although switch is on

  • Platform information: openhabian latest
    • Hardware: Desktop PC
    • OS: gentoo linux 64 bit
    • Java Runtime Environment: zulu latest
    • openHAB version: 2.5.0.1
  • Issue of the topic: I followed the document for creating a sitemap to create my 1st sitemap. I added all mobile phones, I can see them all in basicui, but the problem is: in the webap I can put the slider to on, but the color of the wifi icon remains grey. From android app, I put the switch to on, but it returns immediately to off.
    All devices in Configuration > Things are “Online”. Devices are connrcted to network.

/etc/openhab2/sitemaps/default.sitemap

sitemap default label="My first sitemap"
  {
    Switch item=Presence_Mobile_Haris label="Mobile Haris"
    Switch item=Presence_Mobile_Konstantina label="Mobile Konstantina"
    Switch item=Presence_Mobile_Venetia label="Mobile Venetia"
  }

/etc/openhab2/items/default.items

    Switch Presence_Mobile_Haris "Mobile Haris" <network> { channel="network:device:192_168_1_11:online" }
    Switch Presence_Mobile_Konstantina "Mobile Konstantina" <network> { channel="network:device:192_168_1_12:online" }
    Switch Presence_Mobile_Venetia "Mobile Venetia" <network> { channel="network:device:192_168_1_13:online" }

Any help please?
Thank you!
PS Happy New Year!

Please use code fences, it makes code and logs much more readable.


Please be aware that.

  1. discourse may change some parts of your text slightly (e.g. “ and ” instead of ")
  2. You can edit your existing postings :wink:

As Udo mentioned please use code fences and note the difference in the " below.

sitemap default label="My first sitemap"
{
Switch item=Presence_Mobile_Haris label="Mobile Haris"
Switch item=Presence_Mobile_Konstantina label="Mobile Konstantina"
Switch item=Presence_Mobile_Venetia label="Mobile Venetia"
} 

You can use VSCode and install the openhab package to help with syntax.

OK, I did that, sorry for inconvenience…

Have you restarted OH since making a change to the file? sudo systemctl restart openhab2

No, but I just did. The problem remains. Thank you!

Are you using Basic or Classic UI and what is selected bitmap or vector? You can check that via PaperUI.

What’s the configuration of the channels? Do you see ON or OFF events for the items in events.log?

In Basic UI icons are always grey.

bitmap or vector, I didn’t find that setting. All settings are default.

All 3 channels are selected for mobile phones.
When I click Show properties:

|arp_state |Disabled|

|dhcp_state |No access right for port 67. Bound to port 6767 instead. Port forwarding necessary!

event log

2020-01-01 21:10:06.913 [ome.event.ItemCommandEvent] - Item 'Presence_Mobile_Haris' received command ON
2020-01-01 21:10:06.916 [nt.ItemStatePredictedEvent] - Presence_Mobile_Haris predicted to become NULL
2020-01-01 21:10:09.288 [ome.event.ItemCommandEvent] - Item 'Presence_Mobile_Haris' received command OFF
2020-01-01 21:10:09.291 [nt.ItemStatePredictedEvent] - Presence_Mobile_Haris predicted to become NULL

NULL means the item is not yet initialized. Need to get your items working for icons to work.

Thank you, how can I initialize them? Phones are working, wifi on.

If the item is configured correctly it will take care of itself but you should not have the predicted to become NULL in the logs. Post your item config to see if there may be an issue.

It was in Simple mode, I didn’t configure item.

I only configured /etc/openhab2/items/default.items
I posted it in 1st post.

The network binding is installed and configured to ping the device for presence detection?

You need to configure the file at etc/openhab2/services/network.cfg

1 Like

@hariskar: Here is my setup for presence detection, hope this helps.

Thing:

Thing network:pingdevice:SiPhone [ hostname="10.0.1.21", uses_ios_wakeup=1, uses_arp_pings=1, retry=30, timeout=15000, refreshInterval=60000 ]

Item:

Group:Switch:AND(OFF,ON) gPresent <present>
Switch Present "Phone is home" <present>
Switch Present_Timer { expire="20m, command=OFF" }
Switch MyDevice <network> (gPresent) { channel="network:pingdevice:SiPhone:online" }

network.cfg

binding.network:allowSystemPings=true
binding.network:allowDHCPlisten=false
binding.network:arpPingToolPath=arping
binding,network:cacheDeviceStateTimeInMS=2000
uses_arp_pings=yes

Rule

rule "start gPresent on system start"
when
    System started
then
    Present.sendCommand(OFF) // assume no one is home
end

rule "gPresent updated, at least one change of state"
when
    Item gPresent received update
then
    // someone came home
    if(gPresent.state == ON && Present.state != ON) { 
        Present_Timer.postUpdate(OFF) // cancel the timer if necessary
        Present.sendCommand(ON)
    }

    // no one is home and timer is not yet ticking (otherwise endless loop)
    else if(gPresent.state == OFF && Present.state != OFF && Present_Timer.state != ON) {
        Present_Timer.sendCommand(ON) // start the timer
    }
end

rule "Present_Timer expired"
when
	Item Present_Timer received command OFF
then
	Present.sendCommand(OFF)
end
2 Likes

Which is it? :grin:

The issue seems related to Item-Channel links. at least that’s what the ‘predicted to become NULL’ usually indicates. Can you show your items and channels in Paper UI (a screenshot)?

Thank you for replies. I’ll start reading how to configure binding and come back later.

/etc/openhab2/items/default.items

    Switch Presence_Mobile_Haris "Mobile Haris" <network> { channel="network:device:192_168_1_11:online" }
    Switch Presence_Mobile_Konstantina "Mobile Konstantina" <network> { channel="network:device:192_168_1_12:online" }
    Switch Presence_Mobile_Venetia "Mobile Venetia" <network> { channel="network:device:192_168_1_13:online" }

@hariskar: In the example above the binding configuration is the network.cfg

You can copy the example and add one of your phones to see how it works. The only thing in items you may want to change is the expire=20m (need to install expire binding via PaperUI) to something that suits you. I use this prevent turning something OFF when I go out of wifi range for a short (20min) time e.g. walk over to neighbors house.

You can also tweak the settings retry, timeout, refreshInterval inside the Thing file if needed. The setting I have work well with iPhone and Android in my home.

1 Like

What is the state of these items? NULL?

These are Read-Only items, you cannot simply turn WiFi presence on…