arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.96k stars 4.77k forks source link

SCD40 console commands not working #15900

Closed circuitmike closed 2 years ago

circuitmike commented 2 years ago

PROBLEM DESCRIPTION

The console commands for the SCD40/SCD41 sensor are not recognized (scd40cal, scd40test, etc.) I compiled my own binary with support for both the SCD30 and SCD40/SCD41 sensors. The console commands for the SCD30 sensor work as expected but those for the SCD40/SCD41 do not. Both sensors are connected simultaneously, if that might matter. I did check the source code and the commands are listed there, as is the code meant to handle them.

REQUESTED INFORMATION

TO REPRODUCE

Attempt to use any of the scd40 console commands (scd40test, scd40cal, etc.)

EXPECTED BEHAVIOUR

The commands would execute as expected, as they do with the SCD30 sensor

SCREENSHOTS

N/A

ADDITIONAL CONTEXT

N/A

(Please, remember to close the issue when the problem has been addressed)

barbudor commented 2 years ago

It looks like some commands including Scd40Cal and Scd40Test (but not only) requires measurment to be stopped in order to be proceed You should use Scd40Stop before attempting any of these function and then use eihter Scd40Strt or Scd40StLP to restart measuments

As there doesn't seem to be any specific documentation page about this driver, a contributor who has the device and learned how to use it the hard-way would be welcomed to participate to the docs.

circuitmike commented 2 years ago

scd40stop returns the same error message as the other commands, unfortunately. That's interesting, though - I didn't even notice that that command existed. I think I'll dig into the source code a bit more and see if I can figure out what's going on here. And if I do eventually get this figured out I'd be happy to contribute to the documentation!

barbudor commented 2 years ago

Ah, that's unfortunate Without the device in hand, I would be difficult to go further If you are able to do some coding, this driver lacks debug messages that would be helpful to understand hte cause of the failure. I see from your StatusSNS that the SCD40 is there, so the driver is enabled and the device is detected (driver not included, not enabled or device not detected is a common source of not working commands - not the case here apparently)

May be you could try with only the SCD40 connected (and disabling the SCD30 driver) just to narrow donw the things

sfromis commented 2 years ago

11329 has a little bit of discussion of the commands, including this point:

Most commands can only be issued when no periodic (low power or regular) measurement is being done.

(And that the intention about creating documentation too, but....)

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.

circuitmike commented 2 years ago

I don't want the bot to close this so I'm replying. I still haven't had a chance to dig into the code, but I have the hardware sitting on my desk and I'll take a look soon.

circuitmike commented 2 years ago

I recompiled 12.0.2 with support for the SCD40/41 but without support for the SCD30. Interestingly, the commands that returned "unknown command" errors in the past now seem to work fine, even with both sensors connected. I'm not sure yet why this is, but I'm thinking there's a duplicate symbol somewhere or something like that, maybe as the result of a copy-and-paste operation since the SCD40/41 and SCD30 sensor code are so similar, the latter being based on the former. I'll continue to dig and see what I come up with.

arendst commented 2 years ago

Pls verify using latest dev release and report back.

circuitmike commented 2 years ago

OK, after some false starts (and a couple of deleted comments as a result) I can confirm that the problem no longer exists in the latest dev version. Everything seems fine now. Thanks for everyone's help!