Toggle button and Hue

Forum to ask for any help
Post Reply
User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Toggle button and Hue

Post by Greggus44 » Sat Dec 19, 2020 7:12 pm

So im getting in a bit of a muddle ive tried to follow the instructions here viewtopic.php?f=7&t=33 ive got my hue hub commands setup and tested but I cannot get the toggle to work.
what am I doing wrong ?
hue toggle.JPG
You do not have the required permissions to view the files attached to this post.

User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Re: Toggle button and Hue

Post by Greggus44 » Sun Dec 20, 2020 2:29 pm

Ok ive tried 2 other methods-
Method 2
2 buttons with 2 flags and separate command and there assigned hide an reveal flags set.
toggle on.JPG
toggle off.JPG
This doesnt seem to get any reaction.

Method 3
1 button with single flag associated with the highlight action
toggle dual.JPG
This seems to give me the on function but not the off.

ive tested both commands and they work but the best I can get is it to go on via the toggle.

Any suggestion?
You do not have the required permissions to view the files attached to this post.

User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Re: Toggle button and Hue

Post by Greggus44 » Sun Dec 20, 2020 2:44 pm

Right!

Now im getting the light to come on and go off with method 3 but it doesn't do it on every toggle so I toggle on and it goes on then I toggle off and nothing so I go in and off at least 2 more times and it goes off, then the same happens for it to go on.
Would this be a feedback issue maybe?

Sorry if that's a dumb question I'm painfully new to this/

User avatar
DemoPad
Site Admin
Posts: 764
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Re: Toggle button and Hue

Post by DemoPad » Mon Dec 21, 2020 10:47 am

Method 3 is the easiest approach, and you look to have it set up correctly. You can test using Hercules in TCP server mode, port 80 listen, and alter the IP address of the device in Designer to match your PC. That way you get to see the commands coming from the app in order to confirm they are correct.

My suspicion is that the command is not formed entirely correctly - try the 'disconnect after each command' option for the button, it could be that the device is waiting for extra characters from the previous command etc, and take a few commands to catch up & reset. With disconnect after each command ticked, each new command starts from scratch

User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Re: Toggle button and Hue

Post by Greggus44 » Mon Dec 21, 2020 3:20 pm

Ok cool thanks il give it a shot and feed back

User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Re: Toggle button and Hue

Post by Greggus44 » Mon Dec 21, 2020 7:50 pm

Ok so checked using hercules and the commands look ok
command return.JPG
I finally found the disconnect after each command option , didn't know that box expanded out lol.
Device properties.JPG
But still no luck.

The command im using is apart from ip and hub id is copy and paste from another post here and works on single button command, im seriously new to this so its hard to get my head around.
command send.JPG
You do not have the required permissions to view the files attached to this post.

User avatar
DemoPad
Site Admin
Posts: 764
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Re: Toggle button and Hue

Post by DemoPad » Tue Dec 22, 2020 10:53 am

Ok - next thing to try is Hercules in TCP Client mode to see if you get the same behaviour. Note Hercules uses $ instead of \x so use $0D$0A instead of \x0D\x0A

A few things I note in your commands though, after the Content-Length, you have \x0A\x0A - I would expect this to be \x0D\x0A. Plus the Content-Length parameter should be accurate - {"on":true} is 11 characters, not 12, so I can imagine the server is waiting for the extra character etc.

User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Re: Toggle button and Hue

Post by Greggus44 » Tue Dec 22, 2020 6:56 pm

Right so I tried changing the characters from 12 to 11 and the test command still worked then I changed the A to a D and the command dint work at all , then I opened Hercules in TCP Client but in the hue hub IP and port 80 connected and sent the command ( I used an online tool to convert to hex)
and I got the following response
TCP client.JPG
I dont understand how if I give the button a single command it works but when I try and toggle it doesn't also and it maybe my imagination or just coincidence but the eventual response seems to be double the action each time , so I turn on light comes on ,I toggle 3 times and it goes off , I toggle 6 times and its back on then 12 times and it goes off but it could just be coincidence.
You do not have the required permissions to view the files attached to this post.

User avatar
DemoPad
Site Admin
Posts: 764
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Re: Toggle button and Hue

Post by DemoPad » Wed Dec 23, 2020 10:43 am

The Bad Request response above is likely because you are using \x instead of $ for the hex characters - Hercules requires that you use $0D instead of \x0D - suggest using text rather than your online hex converter, which will be taking \x0D\x0A and treating it as 8 characters, rather than the 2 it should be (carriage return + line feed)

User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Re: Toggle button and Hue

Post by Greggus44 » Wed Dec 23, 2020 5:14 pm

Ok that got it and the lights responded as they do when tested in the command folder, ignore the change from light 1 to 6 it was just a case of light 6 is easier to see from my desk.
client.JPG
You do not have the required permissions to view the files attached to this post.

User avatar
Greggus44
Posts: 28
Joined: Sun Dec 22, 2019 9:41 pm

Re: Toggle button and Hue

Post by Greggus44 » Wed Dec 23, 2020 6:18 pm

I played a bit more and removed one of the commands so the toggle switch only turn it on then I do a command test to turn it off , and it seems to work much better although not perfect and doesn't give me toggle , basically I turn it on it works I send the off command it goes of then I need to toggle it off , on then off before it responds again but it does it every time like this without fail

Post Reply