Git Product home page Git Product logo

Comments (17)

dusty81 avatar dusty81 commented on July 28, 2024 1

Just to follow-up, I did test on another Mojave machine and no luck with my script or the test scripts. I'll await what you find! Thanks again.

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

So looking at the state dump of the light, I see that the light should be "on" since the off word is all zeros and dim is currently set. The light color is configured to be r,b,g = (0,0,0) so the light is on and shining "black". Which is a specific failure mode called out in the docs :) I learned that one the hard way.

Edit: I misread the device dump. The light should be "on" and "red" but it's not.

I'm a little more concerned that rainbow isn't working. Does your light work with Embrava's software?

What does this script do?

from blynclight import BlyncLight

l = BlyncLight.get_light()
l.red = 0xff
l.on = True

For reference:

>>> print(l)
Device: 0x2c0d:0x0001
	0x00ff : red
	0x0000 : blue
	0x0000 : green
	0x0000 : off
	0x0000 : dim
	0x0000 : flash
	0x0000 : speed
	0x0000 : music
	0x0000 : play
	0x0000 : repeat
	0x0000 : volume
	0x0000 : mute
	0x0001 : immediate

With the light plugged in, that should set the light's color to red and turn the light on.

from blynclight.

dusty81 avatar dusty81 commented on July 28, 2024

I should have added, I'm running Python 3.7.3 on MacOS 10.14.5. I was thinking the line "0x00ff : red" should be showing solid red. I was afraid for a long time I was doing as you described.

The Embrava utility allows me to manually change the status of the light just like I would expect. I also ensure that is shutdown when I run my script so I can access the devices. I will try to run the test script tomorrow when I'm at the office (with my light) setting the hex directly. Thank you for the assistance!

from blynclight.

dusty81 avatar dusty81 commented on July 28, 2024

I tried to run the lines you provided, without luck! I remove the light and do get an error thrown.

`Python 3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from blynclight import BlyncLight

l = BlyncLight.get_light()
l.red = 0xff
l.on = True
print (l)
Device: 0x2c0d:0x000c
0x00ff : red
0x0000 : blue
0x0000 : green
0x0000 : off
0x0000 : dim
0x0000 : flash
0x0000 : speed
0x0000 : music
0x0000 : play
0x0000 : repeat
0x0000 : volume
0x0000 : mute
0x0001 : immediate

`
I tested with the Embrava Connect client again and verified the light worked there.

Blynclight Plus:

  Product ID:	0x000c
  Vendor ID:	0x2c0d
  Version:	1.00
  Speed:	Up to 1.5 Mb/sec
  Location ID:	0x00400000 / 3
  Current Available (mA):	500
  Current Required (mA):	100
  Extra Operating Current (mA):	0

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

That all looks good unfortunately.

Now I'm wondering if your hidapi library is the problem. On macOS I use brew to install hidapi.

$ brew info hidapi
hidapi: stable 0.8.0-rc1 (bottled), HEAD
Library for communicating with USB and Bluetooth HID devices
https://github.com/signal11/hidapi
/usr/local/Cellar/hidapi/0.8.0-rc1 (17 files, 131.1KB) *
  Poured from bottle on 2019-04-03 at 20:08:10
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/hidapi.rb
==> Dependencies
Build: autoconf ✘, automake ✘, libtool ✘, pkg-config ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 794 (30 days), 2,310 (90 days), 10,192 (365 days)
install_on_request: 222 (30 days), 533 (90 days), 2,261 (365 days)
build_error: 0 (30 days)

Any chance you could attach a photo of the bottom of your light? I'm wondering if different models might be self-identifying the way I expect them to and perhaps I'm sending the wrong command format to the light.

We'll get this figured out one way or another.

from blynclight.

dusty81 avatar dusty81 commented on July 28, 2024

I did the same:

$ brew info hidapi
hidapi: stable 0.8.0-rc1 (bottled), HEAD
Library for communicating with USB and Bluetooth HID devices
https://github.com/signal11/hidapi
/usr/local/Cellar/hidapi/0.8.0-rc1 (17 files, 131.1KB) *
Poured from bottle on 2019-06-10 at 15:04:24
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/hidapi.rb
==> Dependencies
Build: autoconf ✘, automake ✘, libtool ✘, pkg-config ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 794 (30 days), 2,310 (90 days), 10,192 (365 days)
install_on_request: 222 (30 days), 533 (90 days), 2,261 (365 days)
build_error: 0 (30 days)

Photo is attached. I notice the light is copyright 2017.. so hopefully nothing new. :-)

IMG_5354 copy

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

I like your style @dusty81 we can be friends :) All your software seems to at least match my own so that brings it back to my software not driving the light correctly.

You have a much newer light than my test article, so it's possible the command set is different. I'm not quite sure how to debug this and I'm going to have to do some research. Sorry for the delay.

from blynclight.

dusty81 avatar dusty81 commented on July 28, 2024

A bit more...

I went and grabbed a 'mini' light from a co-worker, just to make sure it wasn't the hardware and I couldn't get it to light either.

I did pull the source for HIDAPI and can run the Test GUI.
Screen Shot 2019-06-12 at 12 53 23 PM

Sure thing @JnyJny thank you for being so responsive, I appreciate the help.

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

Ok, I'm going to order a light off of Amazon so I have something to test with. Before I order, can you confirm that this is your model of light?

https://www.amazon.com/Blynclight-Plus-light-office-ringer/dp/B01MQTZL59

from blynclight.

dusty81 avatar dusty81 commented on July 28, 2024

Yup, that's it. I'm also going to take the light home tonight and set it up on my home MacBook Pro to see if I have a software issue on my OS. I'll report back.

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

I've ordered a light to test with, I'll update when I have something to report figured out.

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

Good news, bad news. I can recreate the bug, I don't know how to fix it yet. I don't have as much free time as I'd like to work on this, so don't expect a lot of progress on this in the short term. I'm confident I'll get it figured out eventually.

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

Better news. I know what the problem is and have a proof-of-concept hack that is driving the light correctly. The BlyncLight Plus wants it's command buffer terminated with 0xff22 instead of 0xffff. Hurray for wireshark! Look for a fix probably sometime this week, in the meantime if you feel brave, you can apply this patch:

diff --git a/blynclight/blynclight.py b/blynclight/blynclight.py
index 7d6ed72..7838fce 100644
--- a/blynclight/blynclight.py
+++ b/blynclight/blynclight.py
@@ -125,11 +125,11 @@ class BlyncLight(Structure):
         ("volume", c_uint64, 4),
         ("pad2", c_uint64, 3),
         ("mute", c_uint64, 1),
-        ("eoc", c_uint64, 8),
+        ("eoc", c_uint64, 16),
         # End of Command Word
         # - pad3 and immediate round out the
         #   length of _fields_ to 128 bits
-        ("pad3", c_uint64, 63),
+        ("pad3", c_uint64, 55),
         ("immediate", c_uint64, 1),
     ]
 
diff --git a/blynclight/constants.py b/blynclight/constants.py
index 025796a..0bd6f9a 100644
--- a/blynclight/constants.py
+++ b/blynclight/constants.py
@@ -4,7 +4,7 @@
 import enum
 
 EMBRAVA_VENDOR_IDS = [0x2C0D, 0x0E53]
-END_OF_COMMAND = 0xFF
+END_OF_COMMAND = 0xFF22
 COMMAND_LENGTH = 9
 PAD_VALUE = 0

from blynclight.

dusty81 avatar dusty81 commented on July 28, 2024

I'll see if I can figure out how to pull and test today. :)

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

Just pushed release 0.4.7 to PyPI so you can just pip install -U blynclight and give it a spin.

from blynclight.

dusty81 avatar dusty81 commented on July 28, 2024

Easy to upgrade, pulled from git! Confirmed test programs function and my script is doing as expected! I appreciate the help and the fix! I'll keep working on my script to see if I can enhance it. See: MacJabberBlync.

If I can help test anything in the future, just let me know! Thank you again. Closing.

from blynclight.

JnyJny avatar JnyJny commented on July 28, 2024

Awesome, glad you are using it to do something fun! Open issues if/when you run into trouble.

from blynclight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.