-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report Position of Curtains After Sending Stop Command #31
Conversation
05b8b46
to
ab364bc
Compare
424764e
to
885d557
Compare
I do not own a switchbot curtain motor that I could use for testing. @oetelaar24, could you maybe install this pre-release https://pypi.org/project/switchbot-mqtt/0.7.0a0/#files If that works as expected, I suggest we discuss when the position should be reported (constant interval? upon request?) here: #30 |
Hi @fphammerle, Unfortunatly, it reports an error:
I had to run the pip install command inside my current docker container (0.6.0-armv6) to get the new release. |
Thanks a lot for testing and posting the log, @oetelaar24 ! Apparently scanning ( The easiest fix would probably be running the container as I assume that you would get the same error when running "outside" the container with I'll try to find a different solution |
Thanks for this extra information! Reading in on the issue, I saw this comment which lets me believe there is a way around running the container as root: IanHarvey/bluepy#218 (comment) |
Thanks for your offer to test and suggestion! Unfortunately, Enabling the |
For reference: The permission errors gets raised in >>> import bluepy
>>> scanner = bluepy.btle.Scanner()
>>> scanner._startHelper(iface=scanner.iface)
>>> scanner._mgmtCmd("le on")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/switchbot-mqtt/.venv/lib/python3.8/site-packages/bluepy/btle.py", line 312, in _mgmtCmd
raise BTLEManagementError("Failed to execute management command '%s'" % (cmd), rsp)
bluepy.btle.BTLEManagementError: Failed to execute management command 'le on' (code: 20, error: Permission Denied) or: $ sudo docker run --rm -it --userns host --network host \
fphammerle/switchbot-mqtt@sha256:26255bd711621037b2886407f29ae5ce3453b44f1322e717f4d1e31f30f85b85 \
/switchbot-mqtt/.venv/lib/python3.8/site-packages/bluepy/bluepy-helper
# bluepy-helper.c version 1.3.0 built at 08:12:57 on May 22 2021
le on
rsp=$mgmtcode=$mgmterrestat=h14emsg='Permission Denied syscalls of
|
related question: is it possible to run
apparently, $ sudo setcap cap_net_raw+ep /usr/bin/hcitool
$ strace -e trace=writev hcitool lescan
writev(3, [{iov_base="\1", iov_len=1}, {iov_base="\v \7", iov_len=3}, {iov_base="\1\20\0\20\0\0\0", iov_len=7}], 3) = 11
writev(3, [{iov_base="\1", iov_len=1}, {iov_base="\f \2", iov_len=3}, {iov_base="\1\1", iov_len=2}], 3) = 6
LE Scan ...
[...] stack trace: (gdb) catch syscall writev
Catchpoint 1 (syscall 'writev' [146])
(gdb) r
Starting program: /usr/bin/hcitool lescan
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Catchpoint 1 (call to syscall writev), 0xb6ed1618 in __GI___writev (fd=fd@entry=3, iov=iov@entry=0xbefff7b4,
iovcnt=iovcnt@entry=3) at ../sysdeps/unix/sysv/linux/writev.c:26
26 ../sysdeps/unix/sysv/linux/writev.c: No such file or directory.
(gdb) bt
#0 0xb6ed1618 in __GI___writev (fd=fd@entry=3, iov=iov@entry=0xbefff7b4, iovcnt=iovcnt@entry=3)
at ../sysdeps/unix/sysv/linux/writev.c:26
#1 0x0001ead4 in hci_send_cmd (dd=dd@entry=3, ogf=<optimized out>, ocf=<optimized out>, plen=<optimized out>, param=0xbefff964)
at lib/hci.c:1113
#2 0x0001ec0c in hci_send_req (dd=dd@entry=3, r=0xbefff96c, r@entry=0xbefff964, to=10000, to@entry=0) at lib/hci.c:1143
#3 0x0002210c in hci_le_set_scan_parameters (dd=dd@entry=3, type=type@entry=1 '\001', interval=interval@entry=0,
window=window@entry=0, own_type=0 '\000', own_type@entry=228 '\344', filter=filter@entry=0 '\000', to=to@entry=10000)
at lib/hci.c:2967
#4 0x00016934 in cmd_lescan (dev_id=0, dev_id@entry=-1, argc=<optimized out>, argc@entry=1, argv=<optimized out>,
argv@entry=0xb6ffd100) at tools/hcitool.c:2558
#5 0x00011200 in main (argc=1, argv=<optimized out>) at tools/hcitool.c:3491 https://github.com/bluez/bluez/blob/5.50/tools/hcitool.c#L2558 |
Thanks for looking into it and digging around. |
Thanks! Unfortunately, I haven't found a workaround for the issue described above yet. |
Hi, I see that in #37, you mention
Would that also work for these issues? I mean, I only run it on a RPi anyway so i'm not too worried about the security implications... |
885d557
to
0e9729f
Compare
…or's position (can't enable by default due to `bluepy.btle.BTLEManagementError: Failed to execute management command 'le on'`)
…` triggers `BTLEManagementError` #31 (comment)
c96e826
to
3a614dd
Compare
3a614dd
to
22d3f7b
Compare
@oetelaar24, could you upgrade to the new pre-release You should then see the following instructions how to workaround the issue:
After applying the workaround you should get position reports on the topic |
@fphammerle could you publish an armv6 image of this new pre-release please? My RPi3B only runs armv6 unfortunately... |
Sorry @oetelaar24, I forgot about that. Pushed now: |
It seems to work now:
the position value is somewhat different from the one in the app tho. EDIT: A I get it now, it's reverse of what it says in the app, so 53% opened, is 47% closed. Logical :) I tried adding a position_topic to the cover configuration in hassio, however it doesn't seem to work just yet, I might be doing something wrong :-P
|
Thanks a lot @oetelaar24 for all your tests! I'll release this as |
Happy to help! @fphammerle ! |
Please see #54 (comment) |
#30