Comments (22)
Awesome, thank you for remotely debugging this!
from zigpy-znp.
from zigpy-znp.
Hmm, perhaps the correct way is to set transport.serial.dtr
and transport.serial.rts
instead of transport.serial.dsrdtr
and transport.serial.rtscts
(near the end of uart.py
).
Those appear to generate the same ioctl
calls as the Node.JS serial port library that Z2M uses. The Node.JS library sets both in a single ioctl
call but doing this with PySerial would generate two, which hopefully won't affect anything.
from zigpy-znp.
can you run the same command but with -v
switch to enable debug output?
and when trying to run this commend, you've stopped any other instances of z2m, etc so there's no concurrent access?
from zigpy-znp.
@Adminiuga Many thanks for quick reply! Really appreciate it!
-
No other software that would use it is running
-
PC is rebooted before the test
-
Debug log is attached in screenshot (The color formatting is probably more nice to read than just pasting it herer)
from zigpy-znp.
Probably due to Koenkk/zigbee-herdsman#196
from zigpy-znp.
So it shoud just skip invoking the bootloader on this device?
from zigpy-znp.
I'll have to research the problem itself (and figure out what the terminology means). Try playing with the following setting:
zha:
zigpy_config:
device:
flow_control: hardware # or software
I believe the fix might require changing the flags in https://github.com/zha-ng/zigpy-znp/blob/54b21cfbeae58ed7275a4de58291ab8d143010f9/zigpy_znp/uart.py#L232
If you want to try playing around with it and finding what flags need to be set for your stick, the PySerial flags are all documented: https://pyserial.readthedocs.io/en/latest/pyserial_api.html#serial.Serial.__init__
from zigpy-znp.
hey :)
sure, will try that during the weekend!
just some quick ideas:
- use the debug-fw (mentioned on my docs-page, so we can see in which state the cpu is)
- could be something with the serial pins (rts, dtr) as already mentioned -> those need to be "released"
@puddly maybe you can contact me on telegram? https://t.me/slaesh =)
from zigpy-znp.
this method will invoke the bootloader. we should do the same but with the inverse of DTR to NOT invoke it ;)
from zigpy-znp.
I already tried the flow_control flag in the Home Assistant's UI wizard.
Software is probably the default value - That will show the "Cannot connect to ZHA Device". The hardware option actually crashes my Home Assistant instance. The last line in the docker log is same as in my original post "asyncio.exceptions.TimeoutError".
I can try look in the code as slaesh mentioned to not invoke the bootloader. But that will take me longer as I haven't properly seen the code yet. (I didn't even know it has verbose mode lol )
from zigpy-znp.
I will check it asap
from zigpy-znp.
@MarhyCZ I've pushed a preliminary fix a few minutes ago so it should work if you install the latest dev release within your virtual environment:
$ pip install git+https://github.com/zha-ng/zigpy-znp/
Not 100% sure if HA will end re-installing the latest stable version on startup so you might have to use something like the approach in here: https://github.com/zigpy/bellows/#testing-new-releases
from zigpy-znp.
Awesome! I was installing it from a local git folder. I tried to make a patch, but I just couldn't quickly absorb the asyncio documentation :(
from zigpy-znp.
It still timed out when it was trying to send the SYS.Version.Req() command.
I will try it with maybe with a longer toggle delay.
EDIT: Nope, increasing to 0.3s did not do anything.
from zigpy-znp.
Darn. You can use -vv
for more verbose output but unfortunately this is the same procedure that Z2M is using so I'll just have to wait until I get some hardware that requires this to start up.
The only other thing that I can think of is adding a 1s delay to ZNP.connect
, before the bootloader skip bytes are even sent. PySerial also reconfigures the serial port after each property update so perhaps removing the transport.serial.dsrdtr = False
lines in uart.py
might also work.
from zigpy-znp.
I will try to flash it with the debug fw as slaesh mentioned so we can see if it succeeded to switch it into correct state.
Thank you very much for this huge effort! Really appreciate this. I am going to try all above.
from zigpy-znp.
So adding the 1second delay in ZNP.connect did not help and removing the transport.serial.dsrdtr = False
commands also did not have any effect :/ I will try it with the debug fw.
LOGGER.debug("Waiting 1s before the skip bytes are sent")
await asyncio.sleep(1)
skip = bytes([c.ubl.BootloaderRunMode.FORCE_RUN])
self._uart._transport_write(skip * 256)
from zigpy-znp.
That was freaking it!! I couldn't understand the difference between these two.
Changing the commands to dtr and rts worked! However the 1 second delay in ZNP.conect is also needed. It is not working if I remove the delay. I am making a PR.
from zigpy-znp.
Thanks a lot for the patience! I really appreciate it!
from zigpy-znp.
One thing to note: if you've previously used this stick with a default Z2M install, zigpy-znp will not overwrite the configured network settings when used with HA. These include a fixed PAN ID and network key. You may want to run python -m zigpy_znp.tools.nvram_reset /dev/slaesh
and re-run the energy scan, which will re-form the network with a random key and PAN ID.
from zigpy-znp.
Oh, thanks a lot! Didn't think about it. Thats very helpful!
from zigpy-znp.
Related Issues (20)
- zigpy-packet-api integration in z4d HOT 7
- zigpy-znp application examples HOT 3
- Python3.7 HOT 2
- OTA for Texas Instruments CC1352/CC2652, Z-Stack HOT 7
- Unable to start zigpy-znp HOT 5
- (zigpy_znp.__version__) not available HOT 3
- Dubious licensing HOT 2
- Various failing tests with zigpy==0.54.0 HOT 1
- Dependencies are unclear to me - Docker /alpine/v3.16 HOT 2
- timeout error when read CC2652 Sonoff dongle HOT 1
- Unable to form network - No module named form_network HOT 2
- zigpy_znp.tools.network_backup fails with asyncio.exceptions.CancelledError on SkyConnect HOT 5
- Develco Products "ZigBee Wallplug HA SP2" unsupported frame
- test_on_af_message_callback fails with zigpy==0.59.0
- Unable to pair devices HOT 13
- Better Error Reporting HOT 5
- command "zigpy_znp.tools.nvram_read" Timeout
- `zigpy_znp.tools.network_restore` fails with `AttributeError` HOT 2
- CC2674 (CC2674P/CC2674R) and CC1354 (CC1354P) Zigbee Coordinator compatibility with with zigpy-znp? HOT 2
- MotionSensor detected but stuck at configuration within HomeAssistant (ZHA) HOT 1
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 zigpy-znp.