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

I made some changes on existing files and added the rule you posted above and
network.cfg

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

/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" }

Switch MyDevice { channel="network:pingdevice:192_168_1_11:online" }
Number:Time MyDeviceResponseTime { channel="network:pingdevice:192_168_1_11:latency" }
String Speedtest_Running "Test running ... [%s]" {channel="network:speedtest:local:isRunning"}
Number:Dimensionless Speedtest_Progress "Test progress [%d %unit%]"  {channel="network:speedtest:local:progress"}
Number:DataTransferRate Speedtest_ResultDown "Downlink [%.2f %unit%]"  {channel="network:speedtest:local:rateDown"}
Number:DataTransferRate Speedtest_ResultUp "Uplink [%.2f %unit%]" {channel="network:speedtest:local:rateUp"}
DateTime Speedtest_Start "Test Start [%1$tH:%1$tM]" <time> {channel="network:speedtest:local:testStart"}
DateTime Speedtest_LUD "Timestamp [%1$tH:%1$tM]" <time> {channel="network:speedtest:local:testEnd"}

I added also
/etc/openhab2/things/default.things

Thing network:pingdevice:192_168_1_11 [ hostname="192.168.1.11", uses_arp_pings=1, retry=1, timeout=5000, refreshInterval=60000 ]
Thing network:speedtest:local "SpeedTest 50Mo" @ "Internet" [refreshInterval=20, uploadSize=1000000, url="https://bouygues.testdebit.info/", fileName="50M.iso"]

Sitemap is the same with 1st post. No success
 Thank you


@hariskar: As posted by @noppes123 the “Online” Channel is not build for manual switching ( it is readonly) ! If switched manually the binding would reset it back . I do personally use this channel, however I display it on my sitemap as a string (and transform the ON state to read “Present”).

What is showing in the logs around the time a device goes online or offline?
Can you ping a mobile device (manually) from the openHAB server?

OK, but shouldn’t the wifi icon in /basicui/app become green? Also from mobile app I can’t switch the device to on, the slider goes immediately to off.

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

This is from openHAB server

$ ping 192.168.1.11
PING 192.168.1.11 (192.168.1.11) 56(84) bytes of data.
64 bytes from 192.168.1.11: icmp_seq=2 ttl=64 time=955 ms
64 bytes from 192.168.1.11: icmp_seq=3 ttl=64 time=839 ms
64 bytes from 192.168.1.11: icmp_seq=4 ttl=64 time=761 ms
64 bytes from 192.168.1.11: icmp_seq=5 ttl=64 time=681 ms
64 bytes from 192.168.1.11: icmp_seq=6 ttl=64 time=604 ms

nmap show all ports closed

$ sudo nmap -Pn -sT -p- 192.168.1.11
Starting Nmap 7.70 ( https://nmap.org ) at 2020-01-02 10:59 EET
Nmap scan report for PC192.168.1.11 (192.168.1.11)
Host is up (0.0036s latency).
All 65535 scanned ports on PC192.168.1.11 (192.168.1.11) are closed (63955) or filtered (1580)

Nmap done: 1 IP address (1 host up) scanned in 394.82 seconds

Again, please keep in mind that you cannot change the device status via the UI (by ‘flipping the switch’) on mobile app, web or whatever interface, only the network binding can change the status!

You specified arping as the command to use in the Thing definition:

Is arping installed and available in the PATH for the user running the openHAB daemon?

This is not logging from around the time the device goes online (connect to WiFi) or offline (disconnect WiFi off). Turn WiFi off and on (with a pause in between) and share the event log.

Some more basic questions/remarks:

  • Did you restart openHAB after making the changes?
  • You shouldn’t mix use of text config files and Paper UI to create/define Items, Channel links, etc.
  • Is openHAB running in a container?

Sorry I didn’t reply earlier, but I was not allowed from forum rules, because as a new user I had reached my limit for 1st day, so I had to wait for 9 hours.
I installed today iputils-arping and it is in the $PATH.
I understand that sliders are not for manual switching, but in tutorial (Creating s sitemap) the wifi icon with slider to the right is green, mine is always grey. Is that normal?
In paperui/index.html#/control I can see “Latency” and “last sen” have correct values for all phones.
I switched wifi of may phone to off and after a while to on. Here is the log, thank you:

05:26.008+0200

2020-01-03 16:05:30.023 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_11_lastseen changed from 2020-01-03T16:04:24.898+0200 to 2020-01-03T16:05:25.733+0200

2020-01-03 16:05:30.075 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_7_latency changed from 16.0 ms to 15.0 ms

2020-01-03 16:05:30.180 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_7_lastseen changed from 2020-01-03T16:04:30.028+0200 to 2020-01-03T16:05:30.158+0200

2020-01-03 16:05:31.571 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_3_latency changed from 16.0 ms to 15.0 ms

2020-01-03 16:05:31.668 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_3_lastseen changed from 2020-01-03T16:04:31.528+0200 to 2020-01-03T16:05:31.648+0200

2020-01-03 16:05:31.701 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_6_latency changed from 17.0 ms to 15.0 ms

2020-01-03 16:05:31.831 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_6_lastseen changed from 2020-01-03T16:04:31.658+0200 to 2020-01-03T16:05:31.808+0200

2020-01-03 16:05:33.827 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_5_latency changed from 22.0 ms to 15.0 ms

2020-01-03 16:05:33.857 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_16_lastseen changed from 2020-01-03T16:04:33.680+0200 to 2020-01-03T16:05:33.832+0200

2020-01-03 16:05:33.948 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_5_lastseen changed from 2020-01-03T16:04:33.788+0200 to 2020-01-03T16:05:33.928+0200

2020-01-03 16:05:36.470 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_2_lastseen changed from 2020-01-03T16:04:36.318+0200 to 2020-01-03T16:05:36.448+0200

2020-01-03 16:05:40.364 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_10_latency changed from 15.0 ms to 16.0 ms

2020-01-03 16:05:45.442 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_10_lastseen changed from 2020-01-03T16:04:35.238+0200 to 2020-01-03T16:05:40.345+0200

2020-01-03 16:06:26.138 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_1_lastseen changed from 2020-01-03T16:05:26.008+0200 to 2020-01-03T16:06:26.118+0200

2020-01-03 16:06:30.120 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_11_latency changed from 823.0 ms to 91.0 ms

2020-01-03 16:06:30.198 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_7_latency changed from 15.0 ms to 16.0 ms

2020-01-03 16:06:30.257 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_11_lastseen changed from 2020-01-03T16:05:25.733+0200 to 2020-01-03T16:06:30.238+0200

2020-01-03 16:06:30.318 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_7_lastseen changed from 2020-01-03T16:05:30.158+0200 to 2020-01-03T16:06:30.298+0200

2020-01-03 16:06:31.701 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_3_latency changed from 15.0 ms to 22.0 ms

2020-01-03 16:06:31.799 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_3_lastseen changed from 2020-01-03T16:05:31.648+0200 to 2020-01-03T16:06:31.778+0200

2020-01-03 16:06:31.851 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_6_latency changed from 15.0 ms to 16.0 ms

2020-01-03 16:06:31.948 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_6_lastseen changed from 2020-01-03T16:05:31.808+0200 to 2020-01-03T16:06:31.928+0200

2020-01-03 16:06:33.875 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_16_latency changed from 16.0 ms to 15.0 ms

2020-01-03 16:06:33.974 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_5_latency changed from 15.0 ms to 16.0 ms

2020-01-03 16:06:33.978 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_16_lastseen changed from 2020-01-03T16:05:33.832+0200 to 2020-01-03T16:06:33.958+0200

2020-01-03 16:06:34.076 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_5_lastseen changed from 2020-01-03T16:05:33.928+0200 to 2020-01-03T16:06:34.058+0200

2020-01-03 16:06:36.588 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_2_lastseen changed from 2020-01-03T16:05:36.448+0200 to 2020-01-03T16:06:36.568+0200

2020-01-03 16:06:45.463 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_10_latency changed from 16.0 ms to 15.0 ms

2020-01-03 16:06:50.546 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_10_lastseen changed from 2020-01-03T16:05:40.345+0200 to 2020-01-03T16:06:45.449+0200

2020-01-03 16:07:26.260 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_1_lastseen changed from 2020-01-03T16:06:26.118+0200 to 2020-01-03T16:07:26.238+0200

2020-01-03 16:07:30.334 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_11_latency changed from 91.0 ms to 70.0 ms

2020-01-03 16:07:30.353 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_7_latency changed from 16.0 ms to 21.0 ms

2020-01-03 16:07:30.458 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_7_lastseen changed from 2020-01-03T16:06:30.298+0200 to 2020-01-03T16:07:30.438+0200

2020-01-03 16:07:30.499 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_11_lastseen changed from 2020-01-03T16:06:30.238+0200 to 2020-01-03T16:07:30.478+0200

2020-01-03 16:07:31.822 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_3_latency changed from 22.0 ms to 15.0 ms

2020-01-03 16:07:31.908 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_3_lastseen changed from 2020-01-03T16:06:31.778+0200 to 2020-01-03T16:07:31.888+0200

2020-01-03 16:07:31.969 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_6_latency changed from 16.0 ms to 15.0 ms

2020-01-03 16:07:32.059 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_6_lastseen changed from 2020-01-03T16:06:31.928+0200 to 2020-01-03T16:07:32.038+0200

2020-01-03 16:07:34.102 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_5_latency changed from 16.0 ms to 15.0 ms

2020-01-03 16:07:34.118 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_16_lastseen changed from 2020-01-03T16:06:33.958+0200 to 2020-01-03T16:07:34.089+0200

2020-01-03 16:07:34.196 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_5_lastseen changed from 2020-01-03T16:06:34.058+0200 to 2020-01-03T16:07:34.178+0200

2020-01-03 16:07:36.706 [vent.ItemStateChangedEvent] - network_pingdevice_192_168_1_2_lastseen changed from 2020-01-03T16:06:36.568+0200 to 2020-01-03T16:07:36.697+0200

I didn’t see that in the tutorial?

Here https://www.openhab.org/docs/tutorial/sitemap.html down at the end of the page.

I was looking at this one https://www.openhab.org/docs/configuration/sitemaps.html#sitemaps. :grin:

BTW that looks like a switch not a slider and examples have it labeled as switch and not slider.

:grinning:
OK, mine is like this (but always grey)

Try changing the file and sitemap name then restart OH.

/etc/openhab2/sitemaps/home.sitemap

sitemap home 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"
  }

Note you can change to whatever you like but make sure to use the same name e.g. home file name and home sitemap name.

Thank you, I did it, no difference.

@hariskar: you mentioned earlier in the topic that you had simple mode turned on and you also give an items file example config. If you had simple mode on and created the item in files there may be a duplicate item or link that’s causing the issue.

Look in /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.thing.link.ItemChannelLink.json and make sure there isn’t a Link hanging around. Also, for items check: /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json

If you find a duplicate then stop OH before making a change to either of these files.

I deleted deleted default.items and mobile Things, chose again simple mode and added network discovered mobiles. Now the grey network icon (defined in default.items) is substituted by an always green on/off icon.

@hariskar did you check the locations above for duplicates first?

Even if mobile device is away/off?

I didn’t check, I opened the files, but they are quite big

Yes, even if mobile wifi is off.

Now I see that in default items I had there was only Switch Presence_Mobile_ (Switch Presence_Mobile_Haris “Mobile Haris” { channel=“network:device:192_168_1_11:online” }) defined. Is it a problem?

I’m trying to help with your icon issue and didn’t post the locations just for the heck of it.

Ok, now I’m lost. Are you using simple mode or files? You can not use both without running into issues and yes if that item is in files and simple mode is on.

I use Simple mode because in https://www.openhab.org/docs/tutorial/configuration.html (which is the previous page of Creating a Sitemap) says to choose Simple mode. Then in next page of tutorial: https://www.openhab.org/docs/tutorial/sitemap.html it says to create files. So I guess I use both
 What should I do to clear the situation?

Thank you for all help and sorry I did not check the files


Turn off simple mode, delete the thing/item, stop OH clean cache, restart OH and add the thing/item back.

If you have files you can remove the thing and item using // at the start of each line then save the file. After the cache clean and OH restart go in the file and remove the // and restart OH again.

The other option is use /* at top of file and */ at bottom to comment out an entire section. You will know it’s commented out when it turn a different color (green for me).

1 Like