Giter Site home page Giter Site logo

olimpia_splendid_bi2_modbus_controller's People

Contributors

dumpfheimer avatar r0bb10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

olimpia_splendid_bi2_modbus_controller's Issues

Modbus errors in communication

Hello,

First I want to say thank you for this project! I started to build my self based on modbus tcp/rtu over wifi and raspberry pi, but this project have nice features like MQTT, OTA update, keep alive communication and etc.

I manage few fan coils, each of them have MINI D1 CH340 USB-C and MAX485.
All settings are sended and readed over http. From time to time values which is returned from the fan coil is not accurate.
Also modbusErrorRatio is about 53% errors
Modbus cables are very short and MAX485 is soldered directly over MINI D1

Can you give me suggestions what I can look/debug?

Adding MQTT Discovery for Home Assistant

Hi man! Take a look at this configuration below, this should fix the Home Assistant configuration with sendHomeAssistantConfiguration() by using the correct MQTT Auto Discovery function (details here) that i have tested manually by publishing a JSON in the correct homeassistant topic.

The whole sendHomeAssistantConfiguration() should be replaced by something like sendAutoDiscoveryMsg(), i tried to write it correctly here:

void sendAutoDiscoveryMsg() {
  DynamicJsonDocument doc(1024);
  char buffer[256];

  doc["name"] = "Fancoil " + addr + "";
  doc["unique_id"] = "hvac_" + clientId + "-" + addr + "";
  doc["availability_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/state";
  doc["payload_available"] = "online";
  doc["payload_not_available"] = "offline";
  doc["mode_command_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/mode/set";
  doc["mode_state_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/mode/state";
  doc["modes"] = "heat", "cool", "off";
  doc["min_temp"] = "15";
  doc["max_temp"] = "30";
  doc["precision"] = "0.5";
  doc["retain"] = "true";
  doc["temperature_command_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/setpoint/set";
  doc["temperature_state_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/setpoint/state";
  doc["temp_step"] = "0.5";
  doc["fan_mode_command_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/fan_speed/set";
  doc["fan_mode_state_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/fan_speed/state";
  doc["fan_modes"] = "auto", "high", "low", "night";
  JsonObject device  = doc.createNestedObject("device");
  device["name"] = "Fancoil " + addr + "";
  device["via_device"] = "Fancoil CTRL";
  device["identifiers"] = "hvac_" + clientId + "-" + addr + "";
  device["model"] = "B0872 ModBus";
  device["manufacturer"] = "Olimpia Splendid";
  device["model"] = "Olimpia Splendid";
  device["sw_version"] = "1.0";
  serializeJson(doc, buffer);
  client.publish("homeassistant/climate/hvac_" + clientId + "-" + addr + "/config", buffer);

#ifdef LOAD_WATER_TEMP
  doc["name"] = "Water Sensor";
  doc["unique_id"] = "hvac_" + clientId + "-" + addr + "_water_sensor";
  doc["device_class"] = "temperature";
  doc["state_class"] = "measurement";
  doc["unit_of_measurement"] = "C";
  doc["state_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/water_sensor/state";
  serializeJson(doc, buffer);
  client.publish("homeassistant/sensor/hvac_" + clientId + "-" + addr + "_water_sensor/config", buffer);
#endif

#ifdef LOAD_AMBIENT_TEMP
  doc["name"] = "Ambient Sensor";
  doc["unique_id"] = "hvac_" + clientId + "-" + addr + "_ambient_sensor";
  doc["device_class"] = "temperature";
  doc["state_class"] = "measurement";
  doc["unit_of_measurement"] = "C";
  doc["state_topic"] = "fancoil_ctrl/" + clientId + "/" + addr + "/ambient_sensor/state";
  serializeJson(doc, buffer);
  client.publish("homeassistant/sensor/hvac_" + clientId + "-" + addr + "_ambient_sensor/config", buffer);
#endif
}

The discovery should auto-populate the correct entity in the MQTT integration and should have the ambient/water sensor also if defined, i'm not sure about how many fancoils should be pushed tho, i think it should publish the registered ones if did not mess up anything. The format is JSON that has to be serialized before it can be published in the correct topic but looking online it should work as is. Manually sending the JSON works as expected, this is an example:

{
	"name": "Fancoil 1",
	"send_if_off": true,
	"unique_id": "hvac_C8-C9-A3-54-1B-C7-1",
	"availability_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/state/state",
	"payload_available": "online",
	"payload_not_available": "offline",
	"current_temperature_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/ambient_temperature/state",
	"fan_mode_command_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/fan_speed/set",
	"fan_mode_state_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/fan_speed/state",
	"fan_modes": ["auto", "high", "low", "night"],
	"mode_command_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/mode/set",
	"mode_state_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/mode/state",
	"modes": ["heat", "cool", "off"],
	"min_temp": 15,
	"max_temp": 30,
	"precision": 0.5,
	"retain": true,
	"temperature_command_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/setpoint/set",
	"temperature_state_topic": "fancoil_ctrl/C8-C9-A3-54-1B-C7/1/setpoint/state",
	"temp_step": 0.5,
	"device": {
		"manufacturer": "Olimpia Splendid",
		"via_device": "Fancoil CTRL",
		"identifiers": "hvac_C8-C9-A3-54-1B-C7-1",
		"name": "Fancoil 1",
		"model": "B0872 ModBus",
		"sw_version": "1.0"
	}
}

image
image

I did not make a push request because i'm not sure how to implement and remove the old parts, but this should completely avoid to manually create mqtt.yaml entity and find out the correct topics in the broker, polishing the deploy.

Cheers!

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.