logo elektroda
logo elektroda
X
logo elektroda

Issues with DS1820B Sensor Temperature Reporting - Negative temperature and reports to HA

imvaloo 2478 48
ADVERTISEMENT
  • #1 21269605
    imvaloo
    Level 3  
    Hi everyone,
    I've converted an Antela Smart plug to Openbeken and I'm super happy to be able to remove the cloud from my devices.

    I have modified this energy metering plug to include a DS1820B temperature sensor because I am aiming at monitoring my freezer with it.
    And I have an issue:

    My freezer is obviously below 0 degrees celsius. The Log information reports this correctly, but on the home page and in Home Assistant, it reports the temperature as "Temperature 0.0C (2)". Here is the log:

    Info:CFG:DS1820 - Pin=9 temp=-20.81 
    Info:CFG:DS1820 - High=254 Low=179 Val=333 Tc=2081  -- Read CRC=65 - calculated:65 


    Edit: Temperature is reported in HA, but incorrect.
  • ADVERTISEMENT
  • #2 21269846
    max4elektroda
    Level 20  
    Did you take a different channel for DS1820 (different to the relay...)?
    On the main page of OpenBeken the temperature for DS1820 is wrong, too?
    What's the reading on the channel assigned to DS1820 there?
  • ADVERTISEMENT
  • #3 21269868
    imvaloo
    Level 3  
    >>21269846

    I did use a different channel (2).
    On the main page of OpenBeken the temperature is indeed wrong also. It shows 0 degrees.
    Configuration channel settings list in OpenBeken showing settings for pins P6 to P11.

    OpenBeken home page displays freezer status with incorrect temperature reading of 0 degrees Celsius.
  • #4 21270035
    max4elektroda
    Level 20  
    The temperature line from the sensor on the main page should be something like


    DS1820 Temperature: -20.1 C (read 4 secs ago)

    Could you please check for that line?

    Added after 8 [minutes]:

    And: what's the value of CH 2 shown on main page?

    Added after 2 [hours] 11 [minutes]:

    I don't use HA, so I can only look into the "main page" atm.

    Just did a quick try here, and it seems o.k. (will take a deeper look this afternoon:

    OpenW800 status screen with temperature and WiFi signal data

    Added after 2 [hours] 59 [minutes]:

    O.k., tried here with a W800. This is one device without internal (CPU-)Temperature in GUI, it will allways schow "0" there.

    To get "Temperature" on the Main page, you will need to set this channel (2 in your config) to type "Temperature_div100" (in Web Application or as User command "setChannelType 2 Temperature_div100").

    The "temp" in MQTT is the internal CPU-Temperature (its 0.0 with my W800, too).
    In order to get the DS1820 value, you will need to publish the value:

    publishChannel 2


    will give the integer value of 100*temperature (so -20.81 will be -2081 there).

    Or you add a regular publishing of the float value (you might need to enable "#define ENABLE_EXPAND_CONSTANT 1" in the obk_config.h file for your platform to make "calculation" work):

    addRepeatingEvent 5 -1 publishFloat DS1820Temp $CH2/100


    This is how it looks here (with channel 4 for my DS1820):

    User interface showing details of device W800C0DCE97B2, including DS1820 temperature status.

    Added after 2 [hours] 36 [minutes]:

    imvaloo wrote:
    modified this energy metering plug to include a DS1820B temperature sensor

    Out of curiosity: did you (how) do a galvanic isolation?
    These plugs usually have live voltage potential on the GND/Vcc of CPU so I would never use a sensor outside the plugs case without this security measure.
  • #5 21270950
    imvaloo
    Level 3  
    >>21270035

    I tried to upgrade to the latest firmware because I saw there were some modifications to the DS1820 code, but it broke the readings for me, it was giving errors about the family. So I reverted back to the firmware that I used previously and that reported the temperature.

    I'm currently running 1.17.732.
    My device also reports internal temperature.

    I did set the Temperature to channel 2:
    Screenshot of device configuration settings.

    However on the home page it doesn't show on Channel 2, even though the temperature is reported under DS1820:
    Screenshot of the Antela smart plug user interface displaying power and temperature parameters.

    Thanks a lot for looking into this!

    Regarding the galvanic isolation, my temperature sensor's metal jacket is not connected to anything inside, I checked with a multimeter.
    And my device "Antela smart plug" has a little transformer on the board, so I expect there is some insulation already, but I verified there was no leakage on the metal jacket.
  • #6 21271033
    max4elektroda
    Level 20  
    Regarding the temperature, please see my comment, it needs to be "Temperature_div100"
    (-2081 degrees is simply not reasonable ;-))

    Could you please post the exact error message for the family with the new code ?
    We need to fix this...
    Thanks
  • #7 21271081
    divadiow
    Level 34  
    just trying a few things on my own BK-N/DS1820 - P9/CH2 and a few builds. This particular DS1820 is a Maxim DS18B20 - A1 family - https://www.elektroda.com/rtvforum/topic4056286-30.html#21165112
    Screenshot of the OpenBK7231N user interface showing various device statistics.

    .747 - release before "Improve DS1820 driver (#1382) (ad816b7), closes #1382"
    Screenshot of the OpenBK7231N user interface displaying DS1820 sensor data and system information.

    then on latest build
    OpenBK7231N control screen displaying DS1820 temperature chart and configuration options.
    Code: Text
    Log in, to see the code


    Added after 12 [minutes]:

    BUT

    with a Sensylink CT1820B clone on 1.17.754 (https://www.elektroda.com/rtvforum/topic4062365.html#21158431)

    Code: Text
    Log in, to see the code


    Added after 5 [minutes]:

    on a related driver function note, is adding the fake/clone/family check function seen in https://github.com/koendv/CheckDS18B20 a possibility so users can be state what their ACTUAL device is too when reporting issues?

    Added after 1 [hours]:

    Maybe the "Internal temperature" name should be a little clearer too. Doesn't really say what it's internal to. Inside the case of the device? Inside the CPU? Inside a sensor (if the device has other sensors and the user doesn't know yet how they're distinguished in the GUI)?

    Ideas:
    Core Temperature
    MCU Chip Temp
    SoC Temperature
    Processor Temp
    CPU Temp

    I think I prefer SoC. But, thoughts?

    Added after 2 [minutes]:

    or maybe the platform type is a variable somewhere and it could be

    "%platform% MCU Temperature:"
    "%platform% CPU Temperature:"
    "%platform% SoC Temperature:"

    So there'd be no mistaking something that says "BL602 SoC Temperature", "BK7231N SoC Temperature" etc etc
  • #8 21271226
    max4elektroda
    Level 20  
    divadiow wrote:
    Error:SENSOR:DS1820[9] - Family not discovered

    That's not good.
    Will take a look on how to fix this, without doing a full family check.
    The driver intentionally was named "simple" ;-)

    I think I'll start with just reporting an unknown family and not rejecting it.
    Then see how we can distinguish old 1820 (which needs special treatment) from "all others".
  • #9 21271231
    divadiow
    Level 34  
    yep yep, sure. I just went off on a wishlist tangent ;)
  • #10 21271283
    max4elektroda
    Level 20  
    BTW, in DEBUG the family discovered should be visible:

       if (family == 0x10 || family == 0x28) {
          ds18_family = family;
          DS1820_LOG(INFO, "Discover Family - discovered %x", family);
          return 1;
       } else {
          DS1820_LOG(DEBUG, "Discover Family %x not supported", family);
          return 0;
       }


    And there might be another issue following the datasheet of Sensylink CT1820B
    64-bit ROMID definition including CRC code, serial number, and family code.
    the family is 0x28 here, too

    Added after 38 [minutes]:

    Just checked some other pages - even the faked ones should report family 0x28.

    So there must be something else causing the issue...

    Added after 17 [minutes]:

    It would be great to get the "DEBUG" output to see, where it fails:
    Beside a really "unknown" family, it could be a failed reset, CRC error, everything that can go wrong in "DS1820_DiscoverFamily()"
  • ADVERTISEMENT
  • #11 21271360
    divadiow
    Level 34  
    Code: Text
    Log in, to see the code


    the extent of DS1820 logs on EXTRADEBUG level
  • #12 21271408
    max4elektroda
    Level 20  
    Thanks - so it "discovers" family 0 instead of 0x28.
    Opened https://github.com/openshwprojects/OpenBK7231T_App/pull/1394 for some additional output.
    Let's see if we can get closer to the source of the issue...
    My "problem" is, that all sensors I have will pass the check, so I need your support here (again, this becomes a habit: I do some code and let you do the tests ...)
  • #13 21271409
    divadiow
    Level 34  
    1394_merge_9665a7da33cb

    Code: Text
    Log in, to see the code


    Added after 7 [minutes]:

    same PR with the Maxim. ALL logging level

    Code: Text
    Log in, to see the code
  • #14 21271507
    max4elektroda
    Level 20  
    divadiow wrote:
    Discover Family 0 not supported (read ROM: 0 0 0 0 0 0 0 0)

    Hm, looks the sensor doesn't report the ROM at all.

    But the datasheet I found also lists "0x33" as "read ROM":
    https://www.micros.com.pl/mediaserver/UIDS1820BZ_SEN_SENSYLINK_0001.pdf

    Did I get it right: Even with the changed code in "1394_merge_9665a7da33cb" there are no temperatures shown for SensyLink?
  • ADVERTISEMENT
  • #15 21271529
    divadiow
    Level 34  
    max4elektroda wrote:
    Did I get it right: Even with the changed code in "1394_merge_9665a7da33cb" there are no temperatures shown for SensyLink?


    correct. no temps are read with the Sensylink with that PR. Here is ALL level log from start of driver

    Code: Text
    Log in, to see the code


    Screenshot showing temperature readings from the DS1820 sensor.

    Added after 2 [minutes]:

    powersave 0 for all this, if there was any query about the state of that
  • #16 21271549
    imvaloo
    Level 3  
    After upgrading again to the latest firmware, I see that it's now reported correctly, both in Home Assistant and on the Dashboard.
    Shall I close the topic?
  • #17 21271553
    max4elektroda
    Level 20  
    Hm, all bits "0" or all "1", that doesn't sound too good.

    But Sensylink used to work with the version before the "improvement" (e.g. with .747)?
    I ask, because we didn't change timing, so with the changes I made in the PR, it should(!) simply work as before (even if printing some errors/warnings about the family ...)

    Maybe you could "speed up" the conversions by calling the driver with "startDriver DS1820 1" (so it should do a reading every second, not every 15 seconds as in default).

    Added after 1 [minutes]:

    imvaloo wrote:
    Shall I close the topic?

    Please leave it open, seems there is an issue with some clone sensors ...
  • #18 21271571
    divadiow
    Level 34  
    yeh. let me start again in case it's just me. it did work with .747 yes.

    I'll buy a bundle of clones from Ali I think, I only have 1.

    Added after 30 [minutes]:

    apologies. it was me. reseated all connections and reflashed.

    Sensylink on 1394_merge_9665a7da33cb

    Code: Text
    Log in, to see the code


    Added after 2 [minutes]:

    imvaloo wrote:
    After upgrading again to the latest firmware, I see that it's now reported correctly

    @imvaloo latest being 1.17.756 or the PR version 1394_merge_9665a7da33cb?

    imvaloo wrote:
    I tried to upgrade to the latest firmware because I saw there were some modifications to the DS1820 code, but it broke the readings for me, it was giving errors about the family

    what version was this?
  • #19 21271618
    max4elektroda
    Level 20  
    That's good news @divadiow !
    Thank you so much for all the time you spent!

    Added after 1 [minutes]:

    But let's keep "renaming internal temperature" on the todo list, that's really misleading.
  • #20 21271622
    divadiow
    Level 34  
    no worries. all good fun. I do want more so I can swap between the clones in case any are duff. Also, some other clone brands/families would be interesting.

    Added after 54 [seconds]:

    max4elektroda wrote:
    But let's keep "renaming internal temperature" on the todo list, that's really misleading.

    maybe I'll just make a GH issue so it's there logged for whenever
  • #22 21271739
    divadiow
    Level 34  
    you're a machine!

    BK7231N SoC temperature reading shows 35.3°C. Display showing W600 SoC temperature as 0.0°C. Image showing BK7231T SoC temperature: 61.2°C LN882H SoC temperature: 24.2°C
    Display showing BL602 SoC temperature: 36.6°C. W800 SoC temperature indicator showing 0.0°C.

    Added after 10 [minutes]:

    well, I love it, but I guess it's up to bossman @p.kaczmarek2
  • #23 21271920
    max4elektroda
    Level 20  
    divadiow wrote:
    you're a machine!

    Na, this just made a boring 6 hours trip by train very enjoyable ;-)
  • #24 21272317
    p.kaczmarek2
    Moderator Smart Home
    Hmm so you think that it's more understandable now than "internal"? I hope that our users will know what's "SoC". Maybe better call it "CPU"? Still, it's not technically 100% correct...
    Helpful post? Buy me a coffee.
  • #25 21272321
    divadiow
    Level 34  
    or maybe just "%platform% internal temperature".

    or something else...

    even if SoC is an unknown term to the user, the platform prefix still makes it clearer what the reading refers to. I'd like to think I would infer the gist of the term 'SoC' from the mention of the specific chip/platform beforehand, if I didn't know otherwise. But that's me I guess.
  • #26 21272424
    max4elektroda
    Level 20  
    I also think, "internal" is not clear, if we are talking about a a device like a plug for example. I agree that some users won't know the meaning of SoC.

    So "%platform% temperature" would be better than "internal temperature".

    Or what about
    "%platform% chip temperature" ?
    Or even only "Chip temperature"?
  • #28 21276087
    divadiow
    Level 34  
    boring, but sure ;)

    A little clearer I guess
  • #30 21328143
    sx642005elektroda
    Level 5  
    I would like to know if the DS1820 driver supports multiple temperature sensors ?
    I just did a test with 2 sensors connected and I have the temperature for one but not for the other.
    Here is the error message when I connect the second sensor :
    Info:SENSOR:DS1820[0] - Starting conversion
    Info:SENSOR:DS1820[0] - Temp=21.12
    Info:SENSOR:DS1820[0] - Starting conversion
    Error:SENSOR:DS1820[0] - Read CRC=28 != calculated:6f (errcount=1)
    Error:SENSOR:DS1820[0] - Scratchpad Data Read: 50 1 55 5 7f a5 a5 66 28
    Error:SENSOR:DS1820[0] - Read CRC=28 != calculated:6f (errcount=2)
    Error:SENSOR:DS1820[0] - Scratchpad Data Read: 50 1 55 5 7f a5 a5 66 28
    Error:SENSOR:DS1820[0] - Read CRC=28 != calculated:6f (errcount=3)
    Error:SENSOR:DS1820[0] - Scratchpad Data Read: 50 1 55 5 7f a5 a5 66 28
    Error:SENSOR:DS1820[0] - Read CRC=28 != calculated:6f (errcount=4)
    Error:SENSOR:DS1820[0] - Scratchpad Data Read: 50 1 55 5 7f a5 a5 66 28
    Error:SENSOR:DS1820[0] - Read CRC=28 != calculated:6f (errcount=5)
    Error:SENSOR:DS1820[0] - Scratchpad Data Read: 50 1 55 5 7f a5 a5 66 28
    Error:SENSOR:DS1820[0] - Read CRC=28 != calculated:6f (errcount=6)
    Error:SENSOR:DS1820[0] - Scratchpad Data Read: 50 1 55 5 7f a5 a5 66 28
    Info:SENSOR:DS1820[0] - Starting conversion
    Info:SENSOR:DS1820[0] - Temp=21.06

Topic summary

The discussion addresses issues with DS1820B temperature sensor integration on an Antela Smart Plug flashed with OpenBeken firmware for freezer temperature monitoring. The main problem was incorrect temperature reporting in Home Assistant and the OpenBeken dashboard, showing 0.0°C despite correct negative values in logs. It was clarified that the sensor channel must be set to "Temperature_div100" type to display correct DS1820 readings, as the default "Temperature" channel type reports internal CPU temperature, which can be misleading. Firmware updates introduced a new DS18B20 driver supporting multiple sensors and improved family detection, but some clone sensors (e.g., Sensylink CT1820B) initially failed due to unrecognized family codes and CRC errors. Debug logs revealed that some sensors report family 0 or fail CRC checks, causing driver rejection. Subsequent firmware revisions and pull requests improved compatibility by relaxing family checks and enhancing debug output. The new DS18B20 driver requires explicit activation via "startDriver DS18B20" and supports multiple sensors on a single pin, unlike the older "simple" DS1820 driver. Users reported successful temperature readings and MQTT publishing after applying these updates. Discussions also covered configuration for MQTT update intervals and temperature change thresholds. Naming conventions for internal CPU temperature were debated, suggesting clearer labels like "%platform% chip temperature" instead of "internal temperature." Overall, the thread provides troubleshooting steps, firmware version references, and configuration tips for reliable DS1820B/DS18B20 sensor operation with OpenBeken and Home Assistant integration.
Summary generated by the language model.
ADVERTISEMENT