Coder Social home page Coder Social logo

Comments (24)

ihormelnyk avatar ihormelnyk commented on August 16, 2024

Hi @CurlyMoo ,
You can send any OT command, like described here (advanced requests)
http://ihormelnyk.com/opentherm_library
Also there is a link to OT protocol documentation, you should use status command to enable heating or cooling

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

This is what i've tried, but the only response i get is:

30000
/*
OpenTherm Slave Example
By: Ihor Melnyk
Date: May 1st, 2019
http://ihormelnyk.com
*/

#include <Arduino.h>
#include <OpenTherm.h>

const int inPin = 12;  //for Arduino, 12 for ESP8266 (D6), 19 for ESP32
const int outPin = 13; //for Arduino, 13 for ESP8266 (D7), 23 for ESP32
OpenTherm ot(inPin, outPin, true);

void ICACHE_RAM_ATTR handleInterrupt() {
    ot.handleInterrupt();
}

void processResponse(unsigned long response, OpenThermResponseStatus status) {
    if (status == OpenThermResponseStatus::SUCCESS) {
        Serial.println(String(response, HEX));
    }
}

void setup()
{
    Serial.begin(9600);
    Serial.println("Start");

    ot.begin(handleInterrupt, processResponse);
}

void loop()
{
    bool isReady = ot.isReady();
    if(isReady) {
      unsigned int data = 0xFFFF;
      unsigned long request = ot.buildRequest(OpenThermRequestType::READ, OpenThermMessageID::Tr, data);
      unsigned long response = ot.sendRequestAync(request);
    }
  
    ot.process();
}

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

Hi @CurlyMoo,
If you have SLAVE shield you can't send requests, master device is responsible for sending requests.
So if you have thermostat you can listen to requests from thermostat and send responses using slave shield.
Try sample sketch
https://github.com/ihormelnyk/opentherm_library/blob/master/examples/OpenThermSlave_Demo/OpenThermSlave_Demo.ino

If you are using master shiled
probably you have had DATA-INVALID response

Slave-to-Master Messages
100 READ-ACK
101 WRITE-ACK
110 DATA-INVALID
111 UNKNOWN-DATAID

try to send a valid float temperature
Also you can't send only one command in a loop, you should send different commands sequentially.
Commands support depends on your device implementation (thermostat, boiler)

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

If you have SLAVE shield you can't send requests, master device is responsible for sending requests.

I'm using the slave shield trying to listen to the thermostat values, however, not much showing up using the sample sketch.

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

recheck headers soldering, connections, slave cketch pins configuration, voltage levels on OT wires

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

The thermostat boots fine so powering should not be the issue and i believe that with bad soldering there wouldn't be any response at all. The response i do get is just an endless stream of:

T30000
Bf0030000
T30000
Bf0030000
T30000
Bf0030000
T30000
Bf0030000
T30000
Bf0030000
T30000
Bf0030000

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

So thermostat sends status command with CH and DHW flags enabled and sample sketch just respond with UNKNOWN-DATAID. That is why thermostat just repeats the same command.
You should build a valid response for commands you want to support.
Respond with READ-ACK or WRITE-ACK and valid data bytes for concrete command.

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

Respond with READ-ACK or WRITE-ACK and valid data bytes for concrete command.

And where in the documentation of the library can i get a clue how that works?

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

Check my first response

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

I did, but the example doesn't fully work due to the absence of functions like the: isCentralHeatingEnabled.

I changed the code to:

void processRequest(unsigned long request, OpenThermResponseStatus status) {
    Serial.print(ot.getDataID(request));
    Serial.print(" ");
    Serial.println("T" + String(request, HEX)); //master/thermostat request

    unsigned long response = ot.setBoilerStatus(true, false, true);

    Serial.println("B" + String(response, HEX)); //slave/boiler response
}

Which results in:

3 T30000
B0
3 T30000
B0

If i do this:

void processRequest(unsigned long request, OpenThermResponseStatus status) {
    Serial.print(ot.getDataID(request));
    Serial.print(" ");
    Serial.println("T" + String(request, HEX)); //master/thermostat request

    unsigned long response = ot.buildResponse(OpenThermMessageType::READ_ACK, ot.getDataID(request), 0);

    //send response
    ot.sendResponse(response);
    Serial.println("B" + String(response, HEX)); //slave/boiler response
}

I get this:

Bc0030000
3 T30000
Bc0030000

The f changed to c as the initial byte.

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

Looking at the Tasmota implementation i seem to understand that the library expects me to implement a full handshake and communication strategie. Maybe i was too naive, but i expected it to do that for me...

from opentherm_library.

IgorYbema avatar IgorYbema commented on August 16, 2024

Let me step in. Trying to understand also while learning.

The thermostat requests MsgID3, that is 'slave, give me your config'. So you need to respond with a write_ack (see specifications) and set the bits in the answer for which functions your slave supports.

And yes, the library is only support the basic communications as it seems.

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

The thermostat requests MsgID3, that is 'slave, give me your config'

Which should be the command:

unsigned long response = ot.setBoilerStatus(enableCentralHeating, enableHotWater, enableCooling);

from opentherm_library.

IgorYbema avatar IgorYbema commented on August 16, 2024

So if you change your last config in:
unsigned long response = ot.buildResponse(OpenThermMessageType::WRITE_ACK, ot.getDataID(request), 0);
You probably will see another request.

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

unsigned long response = ot.buildResponse(OpenThermMessageType::WRITE_ACK, ot.getDataID(request), 0);

That gives me: 49 T80310000

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

. You just need to send

Looking at the Tasmota implementation i seem to understand that the library expects me to implement a full handshake and communication strategie. Maybe i was too naive, but i expected it to do that for me...

Library allows you to send any OT command, you just need to build response with type, id and data for concrete command.
Please read OT protocol documentation, there is link in the mentioned article.

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

Library allows you to send any OT command, you just need to build response with type, id and data for concrete command.

That's the issue. For what is simple for you, isn't for developers unknown to OpenTherm. So a basic guideline in the documentation on how a basic handshake + request works (in both slave and master mode) would be much better. The example you're referring to is sadly broken.

As in, just a small heads-up instead of directly referring to the protocol description itself...

from opentherm_library.

IgorYbema avatar IgorYbema commented on August 16, 2024

unsigned long response = ot.buildResponse(OpenThermMessageType::WRITE_ACK, ot.getDataID(request), 0);

That gives me: 49 T80310000

So you now receive a new READ for msgid 49 I believe. And that should be a request for the boiler/slave to responds the upper and lower bounds for the CHsetpoint. Again, you need to respond with write_ack on this msgid and the proper upper and lower bounds.
Yes, this takes a while :)

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

So you now receive a new READ for msgid 49 I believe.

As described in chapter 5.2, i would have expected some more handshake items, but nope.

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

Library allows you to send any OT command, you just need to build response with type, id and data for concrete command.

That's the issue. For what is simple for you, isn't for developers unknown to OpenTherm. So a basic guideline in the documentation on how a basic handshake + request works (in both slave and master mode) would be much better. The example you're referring to is sadly broken.

As in, just a small heads-up instead of directly referring to the protocol description itself...

There is no handshake, just request - response for the concrete command.
The sample sketch is not broken, it is just very basic.
And library has only basic commands which alow you to work with OT protocol.
Unfortunatelly, I do not have time to add user friendly wrappers for all the OT commands.

from opentherm_library.

CurlyMoo avatar CurlyMoo commented on August 16, 2024

The sample sketch is not broken, it is just very basic.

It is, because the function isCentralHeatingEnabled doesn't exist.

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

Sample sketches in the library are valid, the article need to be updated in order to be compatible with latest version of OT library.
Mentioned function can be used for slave response only.

from opentherm_library.

ihormelnyk avatar ihormelnyk commented on August 16, 2024

In general, you can use any OT library you find or you are always welcome to join the contributors of this library and improve it.

from opentherm_library.

IgorYbema avatar IgorYbema commented on August 16, 2024

So after discussing this offline with @CurlyMoo I believe I know what is going wrong.
When changing the buildResponse and sendResponse to buildRequest and sendRequest in previous example (#37 (comment)) it works. However it is a response so the response functions should be used.
This is caused probably because sendResponse is not using the isReady flag so the response can be send while master is active on the line, which is wrong.
Also another weird thing is that buildRequest is not using the message type (unless it is write-data). As read-data is 000 that is not a problem but invalid-data type will never be used, why is this?
Why even use two different routines for buildRequest/sendRequest and buildResponse/sendResponse? They work the same (if these two bugs are removed), except for the reponsetimestamp and openthermstatus set at the end.

from opentherm_library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.