I just got the bond a couple days ago. I’ve been playing around with controlling my office ceiling fan.
I’m running firmware version: v2.14.5
Controlling the fan from the Android app works fine. All commands work.
However when I try to use the curl API I run into a couple issues:
I can’t stop the fan.
a. All the speeds work (except 0 causes it to be 1).
b. None of the power commands seem to have any effect: None of the following does anything TurnOff/TurnOn/TogglePower/Stop
I tried use many different pre-reconfigured fans A1 seems to be the closest but I also tried to configure my own manually but when I did I could not get a list of devices via the API.It just hangs.It also made no difference in terms of being able to turn off the fan.
Again the Android app works fine. All commands work. Although the TurnLightOn,TurnLightOff both toggle the light on and off but I’m OK with that.
I need to be able to stop the fan and I can’t what am I doing wrong?
There’s a command with an action (“ToggleLight”) for this purpose, I think it’s just named “Light”. If you enable the “trust state” feature (in devices/<id>/properties via the API or in the device settings screen in the app), it’ll manage this for you, sending the toggle signal only when appropriate.
I would have expected this to give you an “invalid argument” response. It goes through and changes the speed to 1? That might have been an oversight, I’m not sure if that behavior is specified.
Ok just to be clear: you’re sending a PUT request to the v2/devices/<id>/actions/TurnOff endpoint? What sort of response are you getting?
If by curl: curl -i http://<ip_addr>/v2/devices/<dev_id>/actions/TurnOff -x PUT -d '{}'
I couldn’t figure out how to quote everything so I’ll respond this way:
This works (YAY thanks!) Your docs should be more complete and show this: curl -i http://<ip_addr>/v2/devices/<dev_id>/actions/TurnOff -x PUT -d '{}'
I get a 200 response and the fan stops
This does not: curl -i http://<ip_addr>/v2/devices/<dev_id>/actions/TurnOff
I get a 204 response
Interesting. Your request is like this?
curl -i http://<ip_addr>/v2/devices/
Yes. It hangs when I have used a manually entered device. When I use a pre-existing device it does work.
I would have expected this to give you an “invalid argument” response. It goes through and changes the speed to 1? That might have been an oversight, I’m not sure if that behavior is specified.
Yes using 0 as the argument sets the speed to one always even when the previous speed was off. The docs says this is to be expected:
SetSpeed(speed) : Set speed and turn on. If speed>max_speed, max_speed is assumed. If the fan is off, implicitly turn on the power. Setting speed to zero or a negative value is ignored.
IncreaseSpeed(speeds) : Increase speed of fan by specified number of speeds . If the fan is off, implicitly turn on the power.
DecreaseSpeed(speeds) : Decrease fan speed by specified number of speeds . If attempting to decrease fan speed below 1 , the fan will remain at speed 1. That is, power will not be implicitly turned off. If the power is already off, DecreaseSpeed is ignored.
NOTE: When the device is turned off, the previous speed is remembered. When the fan is then turned back on, it will resume at the previous speed.
Actually the docs are not exactly correct. If the fan is off and you setSpeed it to argument 0 (zero) it will come on and go to speed 1.
Ultimately I’m ok with this behavior as well. I just needed to be able to stop the fan which I can now do.
Ah yeah that’s because this sends a GET, we have GET on an action endpoint returning 204 for some reason that I forget.
Well, it says it should be ignored, so I guess we’re slightly off spec here.
That’s super odd, I can’t think of any reason the type of device could affect this endpoint. By “manually created”, you mean a device that you build command-by-command in the app, right?
Out of curiosity, is it a Fan or Generic or Fireplace type device within Bond that you recorded?
Not talking about in the real world, but which kind of device you manually recorded as far as Bond thinks?
For instance, I have an RF controlled floor lamp that I told Bond was a Fireplace and manually recorded all the buttons I needed.
My “device” endpoint for the Bridge with that manually recorded device does not hang in the API (note that I am on 2.14.5-beta, though) as yours is doing.
I’d be surprised if it had something to do with device type. The firmware basically just holds onto this string, passing it back when requested. Otherwise it does nothing with it.
Hello,
I have the same issue where I have full control in the Bond app. In cli, I can control everything about the fan and light except turn the fan off. Setting fan speed to 0 also defaults to speed 1 for me as well.
Ideas?
OMG, I wasted HOURS this morning trying to get my new power fence gate (Wifi controlled and added to Bond) to open. Adding the empty -d “{}” arguments finally gets it working.
The API documentation needs to be updated to specify that -d MUST be given (even if empty). Or better still, the firmware should be updated to not require any -d arguments.
Anyway, my curl command to TurnOn and TurnOff (open and close) the fence gate is working. Now I need to integrated into my Vera home control with some Lua code. More learning curve ahead…