Dallas temp sensor in Fahrenheit, must be celsius



  • Hi,

    I'm a bit confused on the temperatures my DST is sending.

    send: 0-0-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
    send: 0-0-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3
    send: 0-0-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    sensor started, id=0, parent=0, distance=0
    send: 0-0-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,st=ok:Temperature Sensor
    send: 0-0-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.1
    send: 0-0-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=ok:
    send: 0-0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:75.8
    send: 0-0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:73.7
    send: 0-0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:72.8
    send: 0-0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:72.1
    send: 0-0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:71.7
    

    I used the standard sketch where I see this 'boolean metric' setting (I guess for arranging this):

    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    boolean receivedConfig = false;
    boolean metric = true; 
    // Initialize temperature message
    MyMessage msg(0,V_TEMP);
    

    My Pimatic shows the temp as 70 C.
    I think it is a Fahrenheit vs Celsius mix-up since 70 F is about 21 C which would be correct.


  • Hardware Contributor

    If i read the log correctly: send: 0-0-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=ok: is a request for Metric/Farenheit but the controller does not seem to respond.

    You should have something like:

    read: 0-0-2 s=255,c=3,t=6,pt=0,l=1,sg=0:M
    


  • Strange. I can not see what goes wrong.

    I updated the sketch to just use Celsius.

    Replace this (for the Temperature sketch) from:

     float temperature = static_cast<float(static_cast<int((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    

    With this

     float temperature = static_cast<float>(static_cast<int>((sensors.getTempCByIndex(i)) * 10.)) / 10.;
    

    Related to this topic and the fact I used CodeBender I guess somewhere there is the problem.

    The IsMetric function doesn't seem to work.



  • I tried again to get it to work with the original sketch.

    1. send: 0-0-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
    2. send: 0-0-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3
    3. send: 0-0-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    4. sensor started, id=0, parent=0, distance=0
    5. send: 0-0-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,st=ok:Temperature Sensor
    6. send: 0-0-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.1
    7. send: 0-0-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=ok:
    8. send: 0-0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:66.6
    

    Should the M appear in line 7?
    What is deciding in going for Imperial or Metric?
    Can anyone help me out?


  • Admin

    You should get a in INTERNAL/I_CONFIG message from controller. With a payload of "M".

    Line 7 is the presentation message from your sensor (c=0=PRESENT).

    I cannot see any incoming traffic from your gateway.. Do you have some kind of communication problems? You should have a look in the gateway log.



  • Line 8 is giving the temperature and will keep doing this.
    It is also accepted by my controller (Pimatic on a RasPi) and therefore I did not think of a communication problem.

    Where can I find this gateway log?
    I'm pretty new to this so still learning 😃


  • Admin

    You might wanna check with the Pimatic plugin developer here (in the Pimatic sub forum) or in the Pimatics community.



  • @hek said:

    You should have a look in the gateway log.

    Is this the gateway log?

    debug [pimatic-mysensors]: <- MySensorDST  { sender: 0, sensor: 0, type: 0, value: '72.2' }
    
    15:47:17
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0:72.2
    
    15:45:02
    debug [pimatic-mysensors]: <- MySensorDST  { sender: 0, sensor: 0, type: 0, value: '72.1' }
    
    15:45:02
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0:72.1
    
    15:45:01
    debug [pimatic-mysensors]: <- Presented Node  [ '0', '0', '0', '0', '6', '' ]
    
    15:45:01
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0:
    
    15:45:01
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.1
    
    15:45:01
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0:Temperature Senso
    
    15:44:59
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    
    15:44:59
    debug [pimatic-mysensors]: <- Presented Node  [ '0', '255', '0', '0', '17', '1.5.3' ]
    
    15:44:59
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.3
    
    15:44:59
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
    
    15:44:53
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    
    15:44:53
    debug [pimatic-mysensors]: <- Presented Node  [ '0', '255', '0', '0', '17', '1.5.3' ]
    
    15:44:53
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.3
    
    15:44:53
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE  0;0;3;0;9;read: 0-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0'
    

    I do not see a INTERNAL/I_CONFIG message.



  • Got it working now 😃

    I installed Arduino software and mysensors api again.
    Reloaded my gateway from this install.
    On the node ran the EEPROM sketch from mysensors library and reloaded the DST sketch from also the mysensors library.

    I think something went wrong in library updated Arduino suggested.

    @hek Is it essential to work from the mysensors library (as distributed in the api) and keep that as a stable set and ignoring library updated suggested by the Arduino software?
    And when updating libraries they will updated in a My Documents folder causing Arduino software to generate issues on compiling of having libraries twice. What is the way to work on this?


  • Admin

    @Petjepet said:

    Is it essential to work from the mysensors library (as distributed in the api) and keep that as a stable set and ignoring library updated suggested by the Arduino software?

    You got a bigger chance of getting help if you keep the versions in the distribution.
    But it's not optimal in any way. Would've been nice if the IDE would have some sort package manager like Node where version could be specifed.



  • I agree.
    It is very hard/difficult to keep a consistent set of libraries operational in a broader scope of elements to be managed.


Log in to reply
 

Suggested Topics

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts