I have set up Things
and linked Items
, which allow to identify whether a certain device is linked to the same WIFI network to which using the Network
binding like so:
Thing
UID: network:pingdevice:__0
label: User0
thingTypeUID: network:pingdevice
configuration:
hostname: 192.168.x.x
macAddress: XX:YY:22:BB:AA:99
refreshInterval: 60000
retry: 1
timeout: 5000
channels:
- id: online
channelTypeUID: network:online
label: Online
description: States whether a device is online or offline
configuration: {}
- id: latency
channelTypeUID: network:latency
label: Latency
description: States the latency time
configuration: {}
- id: lastseen
channelTypeUID: network:lastseen
label: Last Seen
description: States the last seen date/time
configuration: {}
Item:
Switch _User_Admin0 "namehere" <"iconify:mdi:alpha-d-box-outline"> (_Users,_Household, _IsHome, _Trusted, _IsGuarded) ["Status","Presence","Admin"] {channel="network:pingdevice:__0:online",widgetOrder="10",listWidget="oh-label-item" [visible="=items._User_Admin0.state=='ON'", badge="Here"]}
This (more or less) works for basic presence detection of individual users. I have set my wifi router DHCP settings such that they reassign a pseudo-static IP address upon each connection.
Now, I’m wondering the following: Can one get this IP (or MAC) address of the client device that is connecting to MainUI and use this inside (custom) widgets to (identify who is using openHAB) and adapt some widget settings (custom visibibility settings, language choice, or custom widget-order come to mind)…
I have no clue, how I would query from within a widget the devices ip address… Any advise?