Page 1 of 1
Toggle button and Hue
Posted: Sat Dec 19, 2020 7:12 pm
by Greggus44
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
Re: Toggle button and Hue
Posted: Sun Dec 20, 2020 2:29 pm
by Greggus44
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?
Re: Toggle button and Hue
Posted: Sun Dec 20, 2020 2:44 pm
by Greggus44
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/
Re: Toggle button and Hue
Posted: Mon Dec 21, 2020 10:47 am
by DemoPad
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
Re: Toggle button and Hue
Posted: Mon Dec 21, 2020 3:20 pm
by Greggus44
Ok cool thanks il give it a shot and feed back
Re: Toggle button and Hue
Posted: Mon Dec 21, 2020 7:50 pm
by Greggus44
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
Re: Toggle button and Hue
Posted: Tue Dec 22, 2020 10:53 am
by DemoPad
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.
Re: Toggle button and Hue
Posted: Tue Dec 22, 2020 6:56 pm
by Greggus44
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.
Re: Toggle button and Hue
Posted: Wed Dec 23, 2020 10:43 am
by DemoPad
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)
Re: Toggle button and Hue
Posted: Wed Dec 23, 2020 5:14 pm
by Greggus44
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
Re: Toggle button and Hue
Posted: Wed Dec 23, 2020 6:18 pm
by Greggus44
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