Homey Community Forum

Homey.ink on a tablet/desktop

Here is some code for selfhosted version…just to complete this discussion with some other solutions :smile:

//			Überwachungsstatus
			if ( device.capabilitiesObj && device.capabilitiesObj.homealarm_state ){
				if ( device.capabilitiesObj.homealarm_state.value == "disarmed" ){
					$deviceElement.classList.toggle('on', false);
					
				}
				else{
					$deviceElement.classList.toggle('on', true);
				}
				//Click-Event for Icon for changing mode on touch/click
				$deviceElement.addEventListener('click', function() {
					if ( nameChange ) { return } // No click when shown capability just changed
					if ( longtouch ) {return} // No click when longtouch was performed
					if ( device.capabilitiesObj.homealarm_state.value == "disarmed" ){
						//$deviceElement.classList.toggle('on', true);
						homey.devices.setCapabilityValue({
							deviceId: device.id,
							capabilityId: 'homealarm_state',
							value: 'armed',
						}).catch(console.error);
					}
					else{
						//$deviceElement.classList.toggle('on', false);
						homey.devices.setCapabilityValue({
							deviceId: device.id,
							capabilityId: 'homealarm_state',
							value: 'disarmed',
						}).catch(console.error);
					}
				});
				//register eventhandler for mode change
				device.makeCapabilityInstance('homealarm_state', function(value){
					var $deviceElement = document.getElementById('device:' + device.id);
					if( $deviceElement ) {
						if ( device.capabilitiesObj.homealarm_state.value == "disarmed" ){
							$deviceElement.classList.toggle('on', false);
						}
						else{
							$deviceElement.classList.toggle('on', true);
						}
					}
				});
			}

I’m using the default Heimdall Surveillance Device in Homey (the one with the house+shield and the surveillance modes).
This Icos is showing the alarm in Homeydash (orange background) because it’s recogniced as sensor, but it’s not showing the mode.
For this I added some Code for:

  1. Showing the state (active/inactive icon)
  2. Make mode change possible with a click on the icon. It changes only between armed and disarmed.

Put this code into homeydash.app.js, function render_devices( ) somewhere after these lines:

devices.forEach(function(device) {
if (!device.ready) {return}
var $deviceElement = document.createElement(‘div’);

2 Likes

could anyone help me here? I want to give the buttons with a co2 values a color for my homey dashboard, the color has succeeded but I am unable to have the color updated automatically as soon as the co2 values change someone have an idea how I can get this done?

Hi, please check the code above. There is a line with “device.makeCapabilityInstance”. This registeres an event handler. When the capability in Homey devices is changed, the Dashboard will execute the code inside the { } brackets.
There you can change your div-element.

Here is another example where I change the color of the displayed temperature when the thermostate temperature is changed:


I think that is what you wanted to do. Good luck :slight_smile:

I use HomeyDash on an old Ipad3 mounted on the wall. I use it on the internal battery. No wires needed. After some minutes not using the screen of the Ipad go to standby and the screen is off. That’s fine. After pushing the on switch the HomeyDash app is directly visible but without actual data. Some lights are switched on with a sensor but in Homeydash the lamp is off for example. After closing HomeyDash an restarting it the problem is solved. btw I don’t use the PI version.

What is a good solution for this problem? For example a (hidden) refresh button.

It already has a refresh button
image

Found!
Tnx for the tip.

Hi, before 2 month Homeydash stop working. I test another computer, another browser, and connection, again and again new connection and authorisation, but i still have blank page, only bottom button

where is a problem ? Maybe is any another dashboard. Thx
I use Homey PRO v4

You must re-add the token. I think it expires or so.

how i can do this ?

What do you mean? Just install the dashboard again, follow the first post if you forgot. Cheers

but i use online version

Then u are in the wrong topic. But this “issue “ u have is because of an incorrect token.

First of all; thanks for developing the dashboard and the manual to install it on a RPi.

It runs on a Pi3 with the iPad theme.
I’ve copied the code for the inside temperature section and converted it for a solar heater.

Just because I’m literally in front of the screen, I just want to have a quick look to check the solar temperature on the roof. That’s why it’s in the top left corner, permanently visible.

Once again, thanks!

2 Likes

I like this, thnx, going to try soon

First of all thanks for the dashboard. I’ve installed it on my rpi. It looks like this:

during the day:

in the evening and night:

The ‘buienradar’ does refresh but the camera doesn’t. This is the code:
index.html

<!-- scripts -->
<script type="text/javascript">
function ChangeMedia(){
    var d = new Date();
    var t = d.getTime();
    document.getElementById('image1').src = "https://api.buienradar.nl/image/1.0/RadarMapNL?w=140&h=140"+t;
    document.getElementById('image2').src = "http://192.168.1.73:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=*****&pwd=********"+t;
}
var reloadcam = setInterval(ChangeMedia, 1000);
</script>
		
<!-- HTML -->
<div id="device" class="device on" style="text-align:left;padding:0;">
	<a href="" target="popup" onclick="window.open('https://gadgets.buienradar.nl/gadget/zoommap/?lat=*********&lng=********&overname=2&zoom=8&naam=******&size=3&voor=1','popup','width=550,height=550'); return false;">
		<img src="https://api.buienradar.nl/image/1.0/RadarMapNL?w=140&h=140" id="image1" class="device" style="opacity: 100">
	</a>
</div>
<div id="device" class="device on" style="text-align:left;padding:0;">
	<a href="" id="image2" target="popup" onclick="window.open('http://192.168.1.73:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=******&pwd=********','popup','width=600,height=600'); return false;">
		<img src="http://192.168.1.73:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=******&pwd=********" id="image2" height="140" width="140" class="device" style="opacity: 100">
	</a>
</div>
2 Likes