Comments (3)
Apparently return value isn't passed across multiple layers. And in the end CLI tool doesn't check return value.
With this quick debug:
diff --git a/xled/cli.py b/xled/cli.py
index 905bc8a..c369d92 100644
--- a/xled/cli.py
+++ b/xled/cli.py
@@ -104,7 +104,8 @@ def get_mode(ctx):
def turn_on(ctx):
control_interface = common_preamble(ctx.obj.get("name"), ctx.obj.get("hostname"))
log.debug("Turning on...")
- control_interface.turn_on()
+ retval = control_interface.turn_on()
+ click.echo(retval.status_code)
click.echo("Turned on.")
diff --git a/xled/control.py b/xled/control.py
index 072e444..7a42b17 100644
--- a/xled/control.py
+++ b/xled/control.py
@@ -329,6 +329,7 @@ class ControlInterface(object):
app_response = ApplicationResponse(response)
required_keys = [u"code"]
assert all(key in app_response.keys() for key in required_keys)
+ return app_response
def set_led_movie_full(self, movie):
"""
An status code: 1104
is printed.
Application apparently continues with call:
{
"mode": "effect",
"effect_id": 0
}
I guess CLI tool/high level interface should do the same.
from xled.
I stumbled upon this myself, and think I understand why it happens:
After factory reset, the led movie config parameters "frame_delay" and "frames_number" are both set to zero, because of course there is no movie uploaded yet. In this situation it refuses to go into "movie" mode, which actually makes sense.
In my resent pull request #80 to enhance the control interface I have included a fix for this. What I do to handle it is twofold:
First, when uploading a movie, the commands are run in the reverse order to the previous code: first set the movie parameters, then upload the movie, and finally switch to movie mode. Then it works fine, also the first time, since the movie is uploaded when trying to switch the mode.
Second, when running "turn_on", the new code tries to remember what mode was used last and returns to that, unless it is the first time, in which case the code checks the movie parameters and only goes to movie mode if there is a non-zero number of uploaded frames, and goes to "effects" mode otherwise (which seems to be the default mode after factory reset, and consistent with the log above).
/ Anders Holst
from xled.
After factory reset, the led movie config parameters "frame_delay" and "frames_number" are both set to zero, because of course there is no movie uploaded yet. In this situation it refuses to go into "movie" mode, which actually makes sense.
@Anders-Holst I have looked into this and indeed these two values are set to 0. On the top of that, while frames_number
could be set to 0 by API, frame_delay
doesn't accept 0 so it would be possible to determine factory reset out from this heuristic.
But in the end I have looked into traffic from the app (3.3.8) against device with lowest FW version I got handy (2.6.2) and it clearly tries to set mode: "playlist", if that doesn't work it continues with "movie" and if that doesn't work either it ends up with "effect".
Rather than using heuristic and internal state, which CLI wouldn't use, I ended up implementing the same logic in #124.
from xled.
Related Issues (20)
- Trick to update app with new mapping? HOT 6
- Xled_plus - use xled to produce various effects HOT 3
- Documentation is rendered incorrectly (inconsistently) on read the docs HOT 2
- xled on not working HOT 4
- xled sometimes hangs, probably when network is flaky HOT 8
- cli --hostname argument does nothing (broadcast ping gets used regardless)
- music dongle support? HOT 1
- How to send messages in `rt` mode? HOT 32
- Discovery when multiple interfaces are present HOT 3
- Add support for new WiFi configuration encryption HOT 1
- Error: Only one usage of each socket address HOT 4
- Validation error HOT 2
- What should I put in octet-stream in uploading movie? HOT 22
- `python setup.py install`/`develop` need manual intervention to install dependencies
- Move this repository to xled organization HOT 4
- "get" Commands Not Functioning As Expected HOT 12
- Example of movie file/stream? HOT 4
- What about adding a Discussion forum for xled in github? HOT 7
- AttributeError: module 'xled' has no attribute 'security' HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xled.