Jump to content
  • 0

Sleep function cvaction

Question

hi, I would like to install a sleep function in the cvaction. How does this work? The light should stay on for e.g. 3 minutes and then slowly go out
I've tried it before but somehow it doesn't work. See pictures. Thanks.

 

# Philips Hue: Licht ausschalten

sleep://3500
http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT: { "on": false, "transitiontime": 500 }

 

 


 

 

image.jpeg

Edited by acid303
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  • Administrator

The preview shortens all sleeps actions to 1 second.  Your code is set for 3.5 seconds and the timestamps show the preview reduction to 1 second.

Then add a blank line after the sleep code.

Link to comment
Share on other sites

  • 0

Thx. The light should stay on for e.g. 3 minutes and then slowly go out. Is there a possibility? I have a single file with curtains up and advertising. Now the action file should be set first and, for example, leave the light on for 3 minutes and then it should slowly turn off. Hope you understand that.

Edited by acid303
Link to comment
Share on other sites

  • 0
  • Administrator

If you want the sleep to be 3 minutes, that would be:

sleep://180000

It is measured in milliseconds.

Your script currently just turns off the light.  I'm not sure if it is being turned on elsewhere or not.  To turn it on, you'd need to add some variation of the following prior to the sleep command:

http://<bridge ip address>/api/<username>/groups/<group name>/action
PUT:{"on":true,"bri":100,"transitiontime":30}

 

 

Link to comment
Share on other sites

  • 0

First of all, thank you for your help.
I have now written it the way you recommended. but the light just stays on. I thought it would stay on for 3 minutes and then slowly go off.

# Philips Hue

sleep://180000

http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT:{"on":true,"bri":100,"transitiontime":30}

Link to comment
Share on other sites

  • 0
  • Administrator

The code you have turns it on.


http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT:{"on":true,"bri":100,"transitiontime":1}

sleep://180000

http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT: { "on": false, "transitiontime": 500 }

To test it, start with 1 section of code to turn it on or off and make sure that works before adding anything else.  You want to make sure that the base code works in your system before adding additional elements to it.

Link to comment
Share on other sites

  • 0
On 9/14/2024 at 6:23 PM, acid303 said:

First of all, thank you for your help.
I have now written it the way you recommended. but the light just stays on. I thought it would stay on for 3 minutes and then slowly go off.

# Philips Hue

sleep://180000

http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT:{"on":true,"bri":100,"transitiontime":30}

Du hast hier den Befehl zum Anschalten, statt zum ausschalten verwendet. In der Klammer das "on": beschreibt den Zustand der Lampe, der hergestellt werden soll. "On": true bedeutet übersetzt "an": wahr, damit wird das Licht also angeschaltet. "On": false bedeutet "an": falsch und schaltet das Öicht dementsprechend aus. Dein Befehl muss also so aussehen:

# Philips Hue

sleep://180000

http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT:{"on": false, "bri": 100, "transitiontime":30}

(Die Leerzeichen müsstest du nochma prüfen; "bri" steht für brightness, also Helligkeit und kann beim Ausschalten auch weggelassen werden)

Matt empfiehlt dir, Schritt für Schritt vorzugehen und erstmal den Basic Lichtaus Befehl in Gang zu setzen und dann nach und nach die Spezifizierungen wie Zeitverzögerung hinzuzufügen. Dann findest du den Fehler leichter

Edited by marius
Link to comment
Share on other sites

  • 0

Ich bin jetzt nochmal alles durch gegangen. mir kommt es so vor, dass die sleep funktion nicht funktioniert. wenn ich die action ausführe wird sofort das licht langsam ausgeschaltet, dass funktioniert. aber die sleep funktion reagiert nicht. hier nochmal wie ich die .cvaction geschrieben habe und weiter unten dann das bild.

 

I've now gone through everything again. It seems to me that the sleep function doesn't work. When I carry out the action, the light is immediately switched off slowly, which works. but the sleep function doesn't respond. Here again how I wrote the .cvaction and then the picture below.

# Philips Hue: Licht ein

sleep://180000


http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT: { "on": true }


# Philips Hue: Licht ausschalten


http://192.168.178.33/api/wsltUbHQbdnDhDEidaNJQg2s85Nv9OldLPE6TYeT/groups/Wand/action
PUT: { "on": false, "transitiontime": 500 }

 

 

20240918_164522.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • 0

 Share

×
×
  • Create New...