lvanderree / com.synplyworks.thenmore

Homey Then functionality

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timer only works one time

driesk81 opened this issue · comments

Thanks for the Timer app. This app should make it so simple to control lights with a motion detector.
Problem is that in my case the app works only one time as intended. After that a restart of the app seems necessarily.
Diagnostic report: 00ff286e-2b36-4129-a6b9-67a141ce5332
Please let me know if the app is still under active development.

Hi @driesk81

since the app is working OK, I haven't been developing much on it. However I do take a look at bug reports and fix issues, when I have time and when things go wrong I try to make some time for it.

I looked at your report, but I cannot see what exactly is going on. I don't know if you've seen it yourself, but this is what I've got:

2019-10-27 22:27:04 [log] [TimerApp] remember state for Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809] (since on and restore on) oldValue 0
2019-10-27 22:27:04 [log] [TimerApp] set device Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809] capability dim to 0.05
2019-10-27 22:27:04 [log] [TimerApp] set timer for device Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809] to 60 seconds, oldValue: false
2019-10-27 22:27:26 [log] [TimerApp] Cancelled timer for device Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809]

2019-10-27 22:27:29 [log] [TimerApp] remember state for Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809] (since on and restore on) oldValue 0.37
2019-10-27 22:27:29 [log] [TimerApp] set device Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809] capability dim to 0.05
2019-10-27 22:27:29 [log] [TimerApp] set timer for device Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809] to 60 seconds, oldValue: 0.37
2019-10-27 22:27:36 [log] [TimerApp] Cancelled timer for device Lampen overloop [fc6201b1-5fc7-49d3-be46-13450dab9809]

You have the lights off,

  • then enable the timer turning a light on (dimmed at 0,05, while it was off),
  • then disable it before the timer ends,
  • then enable it again turning a light on again (dimmed at 0,05, while it was 0,37),
  • then cancel it again

I don't know

  • why you cancel the timer (probably a card somewhere in your flow)
  • and how the light got changed from 0,05 to 0,37

Ok, dus als ik het goed lees verhoog je zelf het dimniveau terwijl de timer loopt, wat er voor zorgt dat de timer gecancelled wordt. Daarna zet je een keer de lamp uit. Vervolgens gaat de timer nooit meer aan.

Dat moet ik denk ik zelf ook kunnen reproduceren. Heb ik alleen niet gelijk tijd voor, maar zal vermoedelijk van de week wel lukken. Waarschijnlijk zit er dan ergens een bug bij de cancel timer functie,waardoor de nieuwe timer niet meer wilt starten.

Ik kan de situatie reproduceren, en ik had de fout helaas zelf ook al eens ervaren, bleek uit het commentaar in mijn code.

		// TODO: reset cache (of athom API), to get the current onoff value (apparantly the cache of the web api can be out of sync)
		// TODO: Or is there maybe another way to get a capability
		const apiDevice = await api.devices.getDevice({ id: device.id });


//		apiDevice.capabilitiesObj.onoff.value  => geeft TRUE als je de lamp met de knop uit gezet hebt, en terwijl de lamp ook in Homey uit staat

Het probleem ontstaat door een bug in de athom api code, waarmee de device state verkregen wordt, maar welke helaas out of sync kan zijn.
In dit geval betekend dat, dat als je je lamp met de hand uit zet, de timer app dit niet door krijgt, en voor altijd zal denken dat de lamp aan staat en daardoor werkt het dus inderdaad niet meer. Ik zal gaan kijken of ik deze cache kan overrulen, want homey zelf weet wel degelijk dat de devices uit staan.

Ik heb denk ik een oplossing om de capabilityValue op een andere manier te verkrijgen, die geen last heeft van de caching. Ik moet dit echt nog wat verder testen en wellicht op meerdere plaatsen toepassen.

Als je weet hoe je apps kunt sideloaden, kan je proberen om branch bugfix/capability te installeren

top, dat met die kids herken ik, heb er zelf ook 2 waarschijnlijk 1 jaartje ouder.
Ik heb versie 0.7.3 gemaakt welke nu bij athom ter review ligt