Device identification

Dear community,

I would like to use the same HABPanel panel configuration for displays in different rooms, i.e. the only difference could be the room temperature where the display is located.

Is there a way to identify the device / display in a custom widget?

Thank you.

HABPanel uses AngularJS.
Using AngularJS you can query a lightweight-web-server in your network.
That service then can return IP and/or name of your client based on the connection request made by AngularJS.

Thank you Wolfgang.

Unfortunately, I am not that familiar with AngularJS to be able to program such a service request. So I leave the point open. Perhaps someone can be found who can provide further details on the AngularJS implementation.

I realized it now via the window size because my devices have different resolutions:

<div oc-lazy-load="['/static/screensize.js']">
	<h3>AngularJs select div dependent on current window width</h3>
		<div ng-controller="get_innerWidth">
			get_innerWidth = {{innerWidth}} pixel
			<div directive1 ng-show="innerWidth < 1280">
				Device1 on windowWidth < 1280
			</div>
			<div directive2 ng-show="innerWidth >= 1280">
				Device2 on windowWidth >= 1280
			</div>
		</div> 
</div>

screensize.js:

(function() {
  'use strict';
  angular
  .module('app', [])
  .controller('get_innerWidth', function($scope) {
	$scope.innerWidth = window.innerWidth; 
  }); 
})();

and I started implementing the suggestion from @Wolfgang_S with a server request based on this example.

<div oc-lazy-load="['/static/myip.js']">
	<h3>show my ip address</h3>
		<div ng-controller="myip">
			ip address = {{ip}} 
		</div> 
</div>

myip.js:

(function() {
  'use strict';
  angular
  .module('app', [])
  .controller('myip', function($scope, $http) {
	$http.get("https://ipinfo.io/json").then(function (response) 
	{
			$scope.ip = response.data.ip;
	});
  }); 
})();
1 Like

and that although your initial reply was

… respect !

1 Like