Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MartinViljoen

Members
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Thanks @MartinViljoen
  2. Like
    MartinViljoen got a reaction from Dharmesh in Connect Home Assistant with Sunsynk   
    Go to Settings --> Devices and services -- Helpers Tab
    Create new helper, select "Text" as the type and call it solarsynkv3_********_settings be sure to replace the redacted text with your inverter serial.

    Entities created via the API are static and unmanageable, therefore it requires you to manual create it.
  3. Like
    MartinViljoen got a reaction from Dharmesh in Connect Home Assistant with Sunsynk   
    There was an issue with the Addon today , SunSynk enhanced their security and the addon had to be adapted.

    https://github.com/martinville/solarsynkv3/issues/48#issuecomment-3576239133

    If you wont write settings back , You can just ignore the message it wont do any harm. But if it bothers you just create the Helper entity.



  4. Like
    MartinViljoen got a reaction from JanKotze in Connect Home Assistant with Sunsynk   
    Hi There.

    Yes its been running for quite some time already --> https://github.com/martinville/solarsynkv3
    Also fully supports sending system mode and battery settings.


  5. Like
    MartinViljoen got a reaction from WazzaCPT in Connect Home Assistant with Sunsynk   
    Unfortunatly not. I havent realy given it thought yet, I dont use this addon anymore I make use of modbus over serial. 
  6. Thanks
    MartinViljoen reacted to nar60 in Connect Home Assistant with Sunsynk   
    Hi @MartinViljoen,
    I have found my issue!! 

    If you check in the logs I send. I did not follow the instructions correct. 

     
    Sending to http://http://192.168.0.87:8123  
    So it never manage to send the information to HA. 
  7. Like
    MartinViljoen got a reaction from nar60 in Connect Home Assistant with Sunsynk   
    Not quite sure. This is bash script and i dont have much error control in it so when ever there is an unexpected string or int encountered it will give this kind of error. But looking at your log I suspect you have a semicolon at the end of your inverter serilal numbers. I.E Serial1;Serial2; Serial1;Serial2  , So its parsing Serial1 Serial2 then a blank serial ?
    Seeing there are many request for better error control , sending settings ect I decided to re-create the addon using python which will be much better. Its almost done i'm in the process of testing it and adding the ability to send settings then I will make it available. instead of
  8. Like
    MartinViljoen got a reaction from nar60 in Connect Home Assistant with Sunsynk   
    I think I know what you mean now. Since the original post further developments were made.
    On the SlipX card there is now a GUI, all you do go to each datapoint and search for the entity you want in order to link it.
    You can also offcoarse opt to manually edit the SlipX configuration yaml file if you wanted to. (Not to be confused with Home assistant's configuration file) 
    I.E 

     
    What I meant in the first post was I named the entities to be similar to the slipx card (On a developer level) so its easy to map them. As a user you cannot change them. The naming of both addon and card also later changed slightly so its not relevant anymore.
  9. Like
    MartinViljoen got a reaction from DoubleP in Connect Home Assistant with Sunsynk   
    It should be fixed now in the new update, the sunsynk server issues is still causing the auth token to not be handed out reliably.
    But to fix this I added a check in place for the script to keep retrying until the server gives a valid token.
     
     
  10. Like
    Maybe not 🙂 It does not quite seem like people are doing it this way.
    Caveat: Its a little bit premature because I'm not quite done with it.  I'm sharing it here just in case someone else is interested so I know in future if I should make it publicly accessible.
    I'm reading my sunsynk inverter via RS232. I prefer it this way because the Sunsynk Serial port has power which can power an ESP32 connected to a RS232 TTL converter. Dont like cables that dangle all over the show. This way is much cleaner compared to what I have seen.
    I simply created a replacement dongle that is fully customizable. Its up to the user to enter the address IDs to be retrieved from the inverter which are sent over to home assistant  with No addons needed. It just needs a long live token generated on HA. When I'm done I will add the ability to download the recipes from Github.

    The Dongle has a web gui that can be used to configure it.

    Some screenshots.
     

     

     

     

     

     

    Some Embarrassing Pics of the Dongle itself. At the time my 3d Printer had some issues with under extrusion.


     

     
     
     

     
     
     
  11. Thanks
    MartinViljoen got a reaction from Iain s in Connect Home Assistant with Sunsynk   
    I havent forgotten about this.
    There is a small issue. The Sunsynk api does not like it if you try updating a single setting. It seems it wants you to update a batch of settings. Also the Automation and scenes screen is limited to a certain amount of characters not allowing you to post the entire set of settings due to the character limitation in HA. Not sure how to get around this yet.

    Hence I started working on an external "Add-on less" solution that runs on an ESP32 as mentioned in the post before this one.
     
  12. Like
    Just a quick line to thanks to slipx and you guys for all this effort. i created my first ever dashboard with the power card and got it working (well mostly). Im running the solar assistant integration and am missing a few sensors /entities, so i need to figure that out now.
    Keep up the great work.
  13. Thanks
    v5.1.0
    What's Changed
    🚀 Exciting New Features
    - feat: you can specify the battery charge cut-off capacity using the `soc_end_of_charge` attribute. If for example you set your battery to charge up to 90% the card will correctly display charge time to this capacity. Expects a numeric value between `80` and `100` or sensor i.e. `sensor.soc_end_of_charge`. closes #514
    - feat: introduces the `navigate` attribute that allows you to link to other dashboards and views e.g. `/lovelace/1` when clicking some of the card icons. It can currently be configured for the battery icon, essential load icon, solar icon, and inverter icon. closes #521
    **Full Changelog**: https://github.com/slipx06/sunsynk-power-flow-card/compare/v5.0.1...v5.1.0
  14. Like
    Maybe not 🙂 It does not quite seem like people are doing it this way.
    Caveat: Its a little bit premature because I'm not quite done with it.  I'm sharing it here just in case someone else is interested so I know in future if I should make it publicly accessible.
    I'm reading my sunsynk inverter via RS232. I prefer it this way because the Sunsynk Serial port has power which can power an ESP32 connected to a RS232 TTL converter. Dont like cables that dangle all over the show. This way is much cleaner compared to what I have seen.
    I simply created a replacement dongle that is fully customizable. Its up to the user to enter the address IDs to be retrieved from the inverter which are sent over to home assistant  with No addons needed. It just needs a long live token generated on HA. When I'm done I will add the ability to download the recipes from Github.

    The Dongle has a web gui that can be used to configure it.

    Some screenshots.
     

     

     

     

     

     

    Some Embarrassing Pics of the Dongle itself. At the time my 3d Printer had some issues with under extrusion.


     

     
     
     

     
     
     
  15. Like
    MartinViljoen got a reaction from system32 in Sunsynk RS485 Modbus RTU request, bytes level   
    @system32
    Just had to pop  in and say thank you for sharing this information. I appreciate it more than you know.
    I translated this into arduino code for an ESP32 and it seem to work just fine. The documentation I have on how to read the inverter via Rs232 does not include the CRC bytes.
    To give some back , Incase anyone is interested in example code, see below.

    The ESP32 runs a web server and the second serial RX,TX pins GPIO 16 & 17 is connected to the inverter's RS232 port using a TTL converter.
    You can send a request for any register you want and it will read 3 of them at a time starting with the one you requested. and it will save the RAW hex to a log file on the ESP32's flash memory.

    Special Note: Most TTL converters that comes with a DB 9 is a female port and my Sunsynk 5Kw inverter's port is also female. A gender changer does not work for some reason. (Unless the one i have is faulty , I did check the pins with a multimeter and it looks fine, or my brain is too small to visualize where the RX TX pins has to go 🙂 )
    I created a temporary Frankenstein board that allows me to tap into the TX/RX lines along with a 5V voltage regulator to bring down 12V to 5V for the VIN pin on the ESP32.
    Warning an LM7805 becomes extremely hot and will most probably give up if you use it for long periods,  this was just a proof of concept.


     
    Once the server is up, 
    you can request any value you want.
    http://ipaddress/send?registeraddress=182 and then retrieve the response like this
    http://ipaddress/log  
    #include "LittleFS.h" #include <WiFi.h> #include <WiFiClient.h> #include <WebServer.h> const char* ssid = "SSID"; const char* password = "PASSWORD"; WebServer server(80); //Define Serial Port 2 #define RXD2 16 #define TXD2 17 int incomingBytePort2=0; void setup() { pinMode(2, OUTPUT); digitalWrite(2, LOW); Serial.begin(9600); // opens serial port, sets data rate to 9600 bps Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2); LittleFS.begin(); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.print("Connecting "); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); server.on("/", handleRoot); server.on("/log",ServeLog); server.on("/deletelog", DeleteLog); server.on("/formatfs",FormatFS); server.on("/send",SendCMD); server.begin(); } void loop() { server.handleClient(); // Read Serial Port 2 if (Serial2.available() > 0) { // read the incoming byte: incomingBytePort2 = Serial2.read(); Serial.print(incomingBytePort2, HEX); Serial.print(","); File file = LittleFS.open("/log.txt", FILE_APPEND); file.print(String(incomingBytePort2,HEX)); file.print(","); file.close(); } } void ServeLog(){ File file = LittleFS.open("/log.txt", "r"); size_t sent = server.streamFile(file, "text/plain"); file.close(); } void handleRoot() { String MainPage=""; MainPage = MainPage + "<a href=""/formatfs"">Format Filesystem</a><br><br><br>"; MainPage = MainPage + "<a href=""/deletelog"">Delete Log</a><br><br><br>"; MainPage = MainPage + "<a href=""/log"">View Log</a><br><br><br>"; MainPage = MainPage + "URL Example /send?registeraddress=184<br><br>"; MainPage = MainPage + "<a href=""/send?registeraddress=182"">Send CMD 182, Batt Temp, Batt Voltage, Batt Capacity </a><br><br><br>"; server.send(200, "text/html", MainPage); } void DeleteLog(){ LittleFS.remove("/log.txt"); server.send(200, "text/plain", "log.txt deleted"); } void FormatFS(){ LittleFS.format(); server.send(200, "text/plain", "FS Formatted"); } void SendCMD(){ int registeraddress=0; String strRegisterAddress=""; for (uint8_t i = 0; i < server.args(); i++) { //Serial.println(server.argName(i)); if(server.argName(i)=="registeraddress") { Serial.println(""); Serial.print("Reading Register:"); Serial.print(server.arg(i)); strRegisterAddress = server.arg(i); registeraddress=strRegisterAddress.toInt(); } } Serial.println(""); Serial.println("Sending Read Request...."); int slave = 1; int count = 3; read_registers(slave, registeraddress, count); server.send(200, "text/plain", "cmd sent"); } // https://github.com/LacobusVentura/MODBUS-CRC16 static uint16_t MODBUS_CRC16_v3(const unsigned char *buf, unsigned int len) { static const uint16_t table[256] = { 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 }; uint8_t Xor = 0; uint16_t crc = 0xFFFF; while (len--) { Xor = (*buf++) ^ crc; crc >>= 8; crc ^= table[Xor]; } return crc; } // https://modbus.org/docs/PI_MBUS_300.pdf int read_registers(uint8_t slave, uint16_t registeraddress, uint16_t number_of_registers) { // See Data and Control Functions - Page 19 // PI_MBUS_300.pdf - Figure 7 Master Query with ASCII/RTU Framing // send cmd buffer to slave byte cmd_buffer[8] = {0}; cmd_buffer[0] = slave; cmd_buffer[1] = 3; // READ REGISTERS cmd_buffer[2] = highByte(registeraddress); cmd_buffer[3] = lowByte(registeraddress); cmd_buffer[4] = highByte(number_of_registers); cmd_buffer[5] = lowByte(number_of_registers); uint16_t crc = MODBUS_CRC16_v3(cmd_buffer, 6); cmd_buffer[6] = lowByte(crc); cmd_buffer[7] = highByte(crc); //Serial.print("cmd_buffer="); //Serial.print(cmd_buffer); //Serial.println(sizeof(cmd_buffer)); Serial2.write(cmd_buffer, sizeof(cmd_buffer)); return 0; }
     
     
     
     
  16. Like
    MartinViljoen reacted to system32 in Sunsynk RS485 Modbus RTU request, bytes level   
    /* * g++ -std=c++17 -o read_registers read_registers.cpp * Author: system32 * Date: 17 Jun 2022 * Version: 0.1 * Copyright: public domain * * See: * https://modbus.org/specs.php * https://modbus.org/docs/PI_MBUS_300.pdf * https://github.com/LacobusVentura/MODBUS-CRC16 * https://www.cmrr.umn.edu/~strupp/serial.html */ #include <string> #include <unistd.h> #include <fcntl.h> #include <termios.h> /* POSIX terminal control definitions */ #include <iostream> // macro version https://www.microchip.com/forums/m393549.aspx #define GET_LO_BYTE(a) *((uint8_t *)&a) #define GET_HI_BYTE(a) *(((uint8_t *)&a) + 1) using namespace std; // https://github.com/LacobusVentura/MODBUS-CRC16 static uint16_t MODBUS_CRC16_v3(const unsigned char *buf, unsigned int len) { static const uint16_t table[256] = { 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 }; uint8_t Xor = 0; uint16_t crc = 0xFFFF; while (len--) { Xor = (*buf++) ^ crc; crc >>= 8; crc ^= table[Xor]; } return crc; } // https://www.cmrr.umn.edu/~strupp/serial.html int open_serial(const std::string& port, const speed_t baud) { // open a serial port and return fd int fd = open(port.c_str(), O_RDWR | O_NOCTTY | O_NDELAY); if (fd == -1) { perror(("open_serial: unable to open " + port).c_str()); exit(1); } // fcntl(fd, F_SETFL, FNDELAY); // no delay read fcntl(fd, F_SETFL, 0); // blocked read struct termios options; tcgetattr(fd, &options); // Get the current options for the port... cfsetspeed(&options, baud); // Set the baud rates cfmakeraw(&options); // Enable Raw Mode options.c_cc[VMIN] = 0; options.c_cc[VTIME] = 10; // 1 second timeout tcsetattr(fd, TCSANOW, &options); // Set the new options for the port... return fd; } void print_buffer(const char* msg, const uint8_t buffer[], int count) { printf(msg); for (int i=0; i<count; i++) if (i+1 < count) printf("0x%.2x, ", buffer[i]); else printf("0x%.2x\n", buffer[i]); } // https://modbus.org/docs/PI_MBUS_300.pdf int read_registers(int fd, uint8_t slave, uint16_t registeraddress, uint16_t number_of_registers) { // See Data and Control Functions - Page 19 // PI_MBUS_300.pdf - Figure 7 Master Query with ASCII/RTU Framing // send cmd buffer to slave uint8_t cmd_buffer[8] = {0}; cmd_buffer[0] = slave; cmd_buffer[1] = 3; // READ REGISTERS cmd_buffer[2] = GET_HI_BYTE(registeraddress); cmd_buffer[3] = GET_LO_BYTE(registeraddress); cmd_buffer[4] = GET_HI_BYTE(number_of_registers); cmd_buffer[5] = GET_LO_BYTE(number_of_registers); uint16_t crc = MODBUS_CRC16_v3(cmd_buffer, 6); cmd_buffer[6] = GET_LO_BYTE(crc); cmd_buffer[7] = GET_HI_BYTE(crc); print_buffer("cmd_buffer=",cmd_buffer,sizeof(cmd_buffer)); write(fd, cmd_buffer, sizeof(cmd_buffer)); sleep(1); // read the result // See PI_MBUS_300.pdf - Figure 8 Slave Response with ASCII/RTU Framing uint8_t result_buffer[64] = {0}; int expect = 5 + number_of_registers * 2; size_t rc = read(fd, result_buffer, expect); print_buffer("result_buffer=",result_buffer,expect); return 0; } int main(int argc, char** argv) { int fd = open_serial("/dev/ttyUSB0", B9600); int slave = 1; int registeraddress = 182; int count = 3; read_registers(fd, slave, registeraddress, count); close(fd); return 0; } Tested on RPI3 attached to SunSynk 8k
    cmd_buffer=0x01, 0x03, 0x00, 0xb6, 0x00, 0x03, 0xe4, 0x2d
    result_buffer=0x01, 0x03, 0x06, 0x04, 0xbc, 0x14, 0x6d, 0x00, 0x5c, 0xe5, 0x3e
    Register 182 (Temperature) = 0x04bc  = (1212 - 1000)/10 = 21.2C
    Register 183 (Volts) = 0x146d  = 5229 / 100 = 52.29V
    Register 184 (SoC) = 0x005c = 92%
  17. Like
    MartinViljoen reacted to Zorque in Connect Home Assistant with Sunsynk   
    Hi all,
    just one note. My auto-generated password for the Sunsynk portal contained a 
    " which made it impossible for the addon to connect. Took me some time to figure that one out and actually read my password for once. 
  18. Like
    MartinViljoen reacted to JeyBee in Connect Home Assistant with Sunsynk   
    Hello Martin.

    Thanks so much for this great integration for SS inverters!
    I can now write settings to my 12kW 3p inverter from HA thanks to your response to my email and link to this page! 👏
    This helps me a lot and I can now automate a few parameter settings to my needs.  

    Thanks so much for your great work! 🤩
    All the best from Norway.
    Jon B
     
  19. Like
    MartinViljoen reacted to RoganDawes in SunSynk WiFi Dongle Hacking.   
    This is mine:
     
    ESP32 talks to the SP3232 transceiver (yellow wires), which has 2 channels in each direction, perfect for 2 UARTs. The jumpers at the bottom either swap RX/TX (two blocks on either side), or connect/disconnect the TX lines from the transceiver/ESP32. When the ESP32 TX lines are disconnected, the ESP32 can snoop but not transmit, which is enough for most purposes.
    I run ESPHome on the ESP32, because it has a ton of useful functionality (OTA updates, built in UART buffering, debug logging via WiFi, etc), and simply put the Sunsynk dongle on one side, and a DE9 cable to the inverter on the other side.
    The string of numbers you posted is actually just the dongle trying to identify the address of the inverter (first column). Second column (3) is a "read holding register" command, starting at address 0, and returning 9 registers. last two columns are the CRC. Apparently the inverter was not responding for some reason. Not connected, maybe?
    0 3 0 0 0 9 132 29 1 3 0 0 0 9 133 204 2 3 0 0 0 9 133 255 3 3 0 0 0 9 132 46 4 3 0 0 0 9 133 153 5 3 0 0 0 9 132 72 6 3 0 0 0 9 132 123 7 3 0 0 0 9 133 170 8 3 0 0 0 9 133 85 9 3 0 0 0 9 132 132 10 3 0 0 0 9 132 183 11 3 0 0 0 9 133 102 12 3 0 0 0 9 132 209 13 3 0 0 0 9 133 0 14 3 0 0 0 9 133 51   
  20. Like
    MartinViljoen got a reaction from DeonBez in SunSynk WiFi Dongle Hacking.   
    This is how I go about sniffing serial traffic between the ports.
    As mentioned the ESP32 has 3 serial ports UART0, UART1 & UART2
     
    #define RXD1 4 #define TXD1 2 #define RXD2 16 #define TXD2 17   void setup() {   Serial1.begin(9600, SERIAL_8N1, RXD1, TXD1); //Dongle   Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2); //Inverter   Serial.begin(9600);   }   void loop() {   //From Dongle   if (Serial1.available() > 0) {     // read the incoming byte:     int incomingByte=0;     incomingByte = Serial1.read();     Serial2.write(incomingByte);   }   //From Inverter   if (Serial2.available() > 0) {     // read the incoming byte:     int incomingByte=0;     incomingByte = Serial2.read();     Serial1.write(incomingByte);   }   }  
    Additionally to the above I make use of web serial to monitor the data
    https://randomnerdtutorials.com/esp32-webserial-library/
    Note the above interferes with the comms but I do get a response from the inverter. Also note the inverter does not send data all the time, It needs to be queried.
    Using SolarAssistant as the "Dongle" I receive the following (Without spaces) that is sent to the inverter before the inverter will respond.
     
    Below is in decimals, but using serial.print(intvalue,HEX); will format it hex if you like.
    0 3 0 0 0 9 132 29 1 3 0 0 0 9 133 204 2 3 0 0 0 9 133 255 3 3 0 0 0 9 132 46 4 3 0 0 0 9 133 153 5 3 0 0 0 9 132 72 6 3 0 0 0 9 132 123 7 3 0 0 0 9 133 170 8 3 0 0 0 9 133 85 9 3 0 0 0 9 132 132 10 3 0 0 0 9 132 183 11 3 0 0 0 9 133 102 12 3 0 0 0 9 132 209 13 3 0 0 0 9 133 0 14 3 0 0 0 9 133 51   
    Perhaps linking directly to the inverter's TX and then send to webserial may be a better idea.
    Not shown in the below image, I use a DB9 Gender Changer to interface with the inverter.

  21. Like
    Try 4.11.2. I explicitly round to 0 decimal places now
  22. Like
    MartinViljoen reacted to Perfo in Connect Home Assistant with Sunsynk   
    I'm new on this Forum but thought I pop in to this thread to say thanks to you Martin for this excellent project. I'm using it for three SunSynk inverts and it works great.  
    The only problems I have are mainly internet related. Thanks for sharing this ....
  23. Like
    MartinViljoen got a reaction from Perfo in Connect Home Assistant with Sunsynk   
    Hey! I'm new to Home Assistant. I have messed with it before in a VM but never took it serious because I didn't really bother to check it out properly. Now I'm shocked with what can be done with it!
    I wanted to connect my HA installation HP600 Mini PC (8GB Ram , 512 SSD and some i3 CPU) After searching a little I and being a bit new to this I couldn't've really find a  quick and easy way to connect to my Sunsynk inverter in the cloud. I dont really care having updates by the second the refresh rate offered by sunsynk.net is good enough for me.
    I'm not sure if the following will be helpful to anyone. But it works well for me. 
    I created a simple HA add-on that will allow you to connect your Sunsynk.net account with your HA instance quick and easy without having to install any additional components.
    Just add the repository to your HA Add-on store and install. 

    All it its is a simple bash script making use of curl to fetch values from sunsynk.net and then those values are posted to some entities in HA. It doesn't come with any thing other than that. You can then add those entities to cards on your dashboard or even map them to the all so awesome card created by SlipX06

    And it only supports 1 single inverter, and sunsynk.net region2
    Full installation instructions here --> https://github.com/martinville/solarsynk/blob/main/DOCS.md
    But if you are like me and you first want to try it and then read the manual 🙂  Here's the link to the repository https://github.com/martinville/solarsynk just add it to your HA store and install.
     

     
    See working example in action.

    For the sake of ease i named the entities exactly as shown in SlipX06's documentation to configure the card. Just substitute "Sunsynk" with "SolarSynk" or just copy the below setup config.
    Lastly if you feel i missed some important data points let me know and I will add them.
    type: custom:sunsynk-power-flow-card cardstyle: lite show_solar: true battery: energy: 0 shutdown_soc: 20 show_daily: true solar: show_daily: true mppts: 2 load: show_daily: true grid: show_daily_buy: true show_daily_sell: false show_nonessential: true entities: use_timer_248: switch.sunsynk_toggle_system_timer priority_load_243: switch.sunsynk_toggle_priority_load inverter_voltage_154: sensor.solarsynk_inverter_voltage load_frequency_192: sensor.solarsynk_load_frequency inverter_current_164: sensor.solarsynk_inverter_current inverter_power_175: sensor.solarsynk_inverter_power grid_connected_status_194: binary_sensor.solarsynk_grid_connected_status inverter_status_59: sensor.solarsynk_overall_state day_battery_charge_70: sensor.solarsynk_day_battery_charge day_battery_discharge_71: sensor.solarsynk_day_battery_discharge battery_voltage_183: sensor.solarsynk_battery_voltage battery_soc_184: sensor.solarsynk_battery_soc battery_power_190: sensor.solarsynk_battery_power battery_current_191: sensor.solarsynk_battery_current grid_power_169: sensor.solarsynk_grid_power day_grid_import_76: sensor.solarsynk_day_grid_import day_grid_export_77: sensor.solarsynk_day_grid_export grid_ct_power_172: sensor.solarsynk_grid_power day_load_energy_84: sensor.solarsynk_day_load_energy essential_power: none nonessential_power: none aux_power_166: sensor.sunsynk_aux_power day_pv_energy_108: sensor.solarsynk_day_pv_energy pv1_power_186: sensor.solarsynk_pv1_power pv2_power_187: sensor.solarsynk_pv2_power pv1_voltage_109: sensor.solarsynk_pv1_voltage pv1_current_110: sensor.solarsynk_pv1_current pv2_voltage_111: sensor.solarsynk_pv2_voltage pv2_current_112: sensor.solarsynk_pv2_current Below is a full list of entities which will be populated. Note that these entities are created via the HA API and will be "Read-Only" you also cannot delete them. But dont be alarmed.
    If you ever wish to remove them, you can just uninstall this addon and then gibe HA a reboot and they should go away on their own.
    battery_capacity battery_chargevolt battery_current battery_dischargevolt battery_power battery_soc battery_temperature battery_type battery_voltage day_battery_charge day_battery_discharge day_grid_export day_grid_import day_load_energy day_pv_energy grid_connected_status grid_frequency grid_power inverter_current inverter_frequency inverter_power inverter_voltage load_current load_frequency load_power load_totalpower load_voltage pv1_current pv1_power pv1_voltage pv2_current pv2_power pv2_voltage overall_state  
     
     
     
     
     
     
     
  24. Thanks
    MartinViljoen got a reaction from Bushbaby in Connect Home Assistant with Sunsynk   
    @Bushbaby good to know it works for you.
    Your way of adding them together should work fine. Off coarse if you are using multiple MPPTs then you would also have to factor in PV1 as well as PV2 for each serial number in your calculation.
     
  25. Like
    MartinViljoen reacted to Bushbaby in Connect Home Assistant with Sunsynk   
    Thank you very much for this @MartinViljoen!
    Very easy and quick to setup with no hardware needed.
    Updated Sunsynk user level to Advanced and getting 60 second updates now which for my use is more than sufficient.
    Getting values for 2 inverters connected in parallel, working great!
    For values eg. _day_pv_energy am I on the right track creating custom sensors and adding up the values from both Inverters, eg.:
    name: "solarsynk_(Inv 1 serial)_(Inv 2 serial)_pv_power_total"
          unit_of_measurement: "W"
          state: >
              {{ (((states.sensor.solarsynk_(Inv 1 serial)_pv1_power.state | float)) + ((states.sensor.solarsynk_(Inv 2 serial)_pv1_power.state | float))) | round(2) }}
          icon: mdi:solar-power-variant-outline
    Then mapping this custom sensor to eg the slipx flow chart?
    Thank you for this integration! Making live easy!

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.