-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Virtual Serialport / Zigbee Router with CC2530 #6095
Comments
Hi, There is no support for that zigbee chip at this moment, but a serial bridge to mqtt feature is already supported in Tasmota. So everything that comes from the serial port can be sent to mqtt and viceversa. If you need Tasmota to manage the initiallation of the chip, you can do it by using Tasmota rules feature, or by commands from mqtt to serial. If you want to develop a driver for that chip, you can fork Tasmota and make a pull request. Help is always welcome. Remember that it is available also the Tasmota Support Chat for helping you. Thanks Contributing Guideline and Policy Support InformationSee Wiki for more information. |
I'm interested in this feature too. Zibgee2MQTT is too big to run on ESP8266, so having a Serial to MQTT would solve nicely this issue. I need to order my CC2530 first. |
@phiten has been working on a Tasmota2Zigbee bridge. He's selected the hardware and has the conceptual architecture for how it would work. He has been looking for some programming help. Please reach out to him. I think this project would fill a huge gap for Tasmota users! Mike |
Thanks, I just ordered my CC2531. The short term solution would be indeed to send all Zigbee traffic to MQTT. It will require a small change in serial part to correctly detect end of frames. I'm not sure whether we can use Zigbee directly from Tasmota. I also found another open-source lib much lighter than Zibgee2MQTT: https://github.com/Frans-Willem/AqaraHub Stay tuned. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Work in progress |
See #6199 for a first step of Zigbee support. It will transfer to and from Mqtt any low-level frame to cc2530. It's not really usable right now, it's an intermediate milestone to ease further development. I don't think you can directly use Zigbee2Mqtt with this although adding an Mqtt bridge to it might be doable. I have plans for direct support at Tasmota level. |
@arendst is this still work in progress ? I bought the hardware, waiting for tasmota only.. |
Yes it's progressing well. I hope to submit a new PR in the following days. You can start flashing cc2530 with instructions from here : https://github.com/s-hadinger/CCLib Or use another way. Just stick to ZNP 1.2 default mode for coordinator. |
@s-hadinger, do I need to flash tasmota to wemo d1 before flashing cc2530? I got wemo d1 hardware and has not done anything on it yet |
So if my understanding is correct
I wondering if step 1 is necessary? |
Sorry for the confusion. You actually need the CCLib variant firmware to flash the CC2530. Once the CC2530 is flashed, then you can use Tasmota |
So for step 1, I need to flash wemo with cclib proxy.ino? |
I checked the CCLib repo, and it was missing some files. Step 1: It takes ~60 minutes to flash, I will try to make it faster. |
Here is what I did
which part did I go wrong ? I cross check the cable multiple times. |
I got different error after flashing WEMO second time.
I got it flashing...... Someone please plugging vcc and gnd for cc2530.. Thanks for all the help... |
So I got everything working Try to get the data into home assistant. It appear that every time it post a data that does not have temperature. It will result home assistant capture blank. There is workaround to check the data using template but if you have lots of zigbee device this now longer feasible. https://community.home-assistant.io/t/mqtt-publish-divided-values-to-same-topic/2236/11
Can I suggest instead |
Good to hear you could make it work. As you are the first to follow these instructions, please report or directly fix the wiki if you found some information inaccurate or unclear. I plan to work on improving the flashing process: first remove the need to short 2 GPIOs, second make it faster (it should normally go down to 3 minutes). Good point on the MQTT format, that is a debate I want to open. Should we have a MQTT topic per device or a unique MQTT topic with device information in the JSON. As for Home Assistant, there is no simple way to fix it. Zigbee2MQTT keeps track of all values of all devices to send them back - but them have unlimited disk storage. We don't have this luxury in Tasmota where Flash is very precious. An easy answer would be to fix HA, and let them have an option to maintain a sensor value to the previous measure if it's missing. Still let me think about it, if we use Wemos D1 mini, we actually got 4MB Flash, so SPIFFS could be an option... |
My vote is that the data transmitted should follow the format used for any other Tasmota sensor. The question perhaps is whether it should be a This allows the data to be used as Rules triggers as well:
A home automation hub has the capability and capacity to handle these situations... even if it takes a bit of extra logic. Using a special topic for each sensor (e.g., |
Also, @digiblur had a great recommendation for something similar involving an RF Bridge...
In your case, you could set up a rule, triggered by the sensor message, to publish the Zigbee sensor data to a specific topic as you wish. |
I tried automation path, home assistant can't keep up with the data. I hv 16 power monitoring switch and hass can't keep up with energy data, some data missed. There are plenty of error 'script still running in the logs.' @s-hadinger, ur step almost prefect. It just did not connect the 3.3v n ground to cc2530 resulting the chip not recognized. I will fix the wiki when I hv desktop with me. Again thanks for all the guide.
|
@tyjtyj Thanks for the feedback. I'm almost surprised everything worked well. This is good news. @meingraham Good insights as always. I will keep it the way it is today, it's important to be consistent with Tasmota sensors. The only thing I may change is putting an alias to replace the address of the device, i.e. have On the topic of missing values in HA, afterthoughts I think it is definitely a HA issue. HA should have an option to maintain a missing value to its previous known value. I prefer Zigbee/Tasmota code to be as neutral as possible: report back in MQTT the reading of the sensor, no more no less. If they are split in different Zigbee message, there will be different MQTT messages. |
I made some substantial edits to the wiki. Hopefully the entire process is accurate... and clearer now. I incorporated some feedback from the Discord mods. |
@tyjtyj Can you please type |
|
@tyjtyj Unfortunately it didn't capture the modelId. One way to get it is to force a re-pairing. Can you please type |
Here you go
I notice my temperature sensor change id after re-pair, it because version upgrade on tasmota or why the id changed ? |
Thanks you. It appears that the JSON above is broken. Was it the actual output? The shortaddr is randomly assigned when pairing, and re-pairing. That's why I want to work on a friendly name based on longaddr which does not change, but is not sent systematically either. I have one more request, can you please check whether the "Temperature" field (which is actually a boolan, so it should show either '0'-false or '0.01'-true) is correlated to the "Occupancy" value? |
let me just post again
Occupancy is
Temperature
|
Thanks for posting logs. Sorry, I meant the wrong "Temperature" reported for device |
I got what you mean by wrong temperature. I think it is xiaomi bug. it does not hv temperature sensor..
can we have this already ?
to sensor ?
i put up automation to parse the data to be usable by home assistant |
There is another issue .. .All the data receive by MQTT is double.
|
I will change from I didn't observe double MQTT message on my side. Did you activate MQTT logging? This would explain why you receive the message twice. I'm considering changing the format of messages from:
It's possible since only one message can be sent or received at a time. It should also be easier to parse with static field names. I'm also considering adding metadata like friendlyname or linkquality: Sending messages would look like: Thoughts? |
I prefer the named pair which labels each field explicitly. Specifically, and also the additional data. And these: For Shutter commands, the current commands: So? |
I voted for this too
and
|
Thanks. Change done. Please note it will be a breaking change in the next PR. @meingraham Here are the Zigbee shutter commands: |
@s-hadinger i am fine with the suggestion from @meingraham |
Here is an actual example of output: |
As long as the keys are keys, and values are values then it's all fine. My only "objection" was to use the DeviceID as key; the "Device": "<id>" payload is okay. |
Is there a possibility that this reply will include two or more devices? |
No it’s not possible. Messages sent or received are mapped to a Zigbee message and can target only one address per message. When sending you can broadcast but it will also be to a single address, namely 0xFFFF. |
Ok, then the payload is fine. I thought that if more than one device could reply in a single message then it would need some nesting, but if that's not the case then I don't have further questions :) |
@s-hadinger which version should i get now i compile zigbee_9_temp and got error
|
Ah... Yes... I forgot to remove this log that gives false errors. You can safely ignore those messages for now. The fix is already in the PR: #6702 |
Add ZigbeeRead command and many improvements (#6095)
ok. upgraded to lasted from arendst and looking great.. I found that pair device will always managed to send data to cc2530 even after i reset by running ZigbeeReset 1 Squence of event. restart es8266 sample below.
|
@s-hadinger |
I agree. |
@jziolkowski mentions key should not be device ID. @jason8266 proposal means we are back to square 1. |
@Jason2866 Let me send the fix in the following minutes. @tyjtyj I might have overstated the effect of What you are seeing here is that device 0x21F3 continued to send data. After a reboot, Tasmota can't know the long address of 0x21F3 without probing or receiving a special packet. When you re-pair, a new address is assigned, but then Tasmota doesn't know what happened to 0x21F3 that got reassigned a new address. I understand it's confusing but there's nothing I can easily do to avoid this. Let me look if there's a way to completely erase the CC2530 (without flashing). |
Is there already a way to connect the CC2530 directly and use it as a Zigbee Router?
There is already a solution with ESP-Easy but I would like to use it with a Sonoff basic running Tasmota:
http://www.zigbee2mqtt.io/how_tos/how_to_esp8266_with_cc2530.html
The text was updated successfully, but these errors were encountered: