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.

Sunsynk Time Sync - can I turn it off?

Featured Replies

Hi all,

I'm not using the Sunsynk App at all as I'm using an ESP32 with Home Assistant to control/monitor my inverter.

With the server issues experienced by Sunsynk (again), I was wondering what impact there will be if I turn off the Time Sync on my Sunsynk Inverter.

I keep losing data (I know 1st world problem) at least once a month so really trying to avoid this issue.

Any input would be greatly appreciated 🙃

Screenshot2024-05-30204655.thumb.png.e94345d03173ebf22764298b72b02d9c.png

Edited by Muttley
Added image

Slipx added some code a while back that will enable you to sync your inverter time with HA instead

 

#Set the interval to sync your inverter time with HA or comment out to disable 

 

It will at the very least remove this ( proving to be ) unreliable variable.  And you won't experience clock drift as a result of turning off completely.

 

So all you need do is update your ESP code

 

10 hours ago, Muttley said:

Hi all,

I'm not using the Sunsynk App at all as I'm using an ESP32 with Home Assistant to control/monitor my inverter.

With the server issues experienced by Sunsynk (again), I was wondering what impact there will be if I turn off the Time Sync on my Sunsynk Inverter.

I keep losing data (I know 1st world problem) at least once a month so really trying to avoid this issue.

Any input would be greatly appreciated 🙃

Screenshot2024-05-30204655.thumb.png.e94345d03173ebf22764298b72b02d9c.png

 

  • Author
1 hour ago, hilt_ctn said:

Slipx added some code a while back that will enable you to sync your inverter time with HA instead

 

#Set the interval to sync your inverter time with HA or comment out to disable 

 

It will at the very least remove this ( proving to be ) unreliable variable.  And you won't experience clock drift as a result of turning off completely.

 

So all you need do is update your ESP code

 

 

Hey,

Nice chatting here and not on MyBB :D
 

Thanks so much... I can't find the code... @slipx would you mind sharing?

There are two approaches. Using a set interval or manual method using a toggle

#Set the interval to sync your inverter time with HA or comment out to disable 
interval:
  - interval: 3600s
    then:
      - lambda: |-
          esphome::modbus_controller::ModbusController *controller = id(inverter);
          time_t now = ::time(nullptr);
          struct tm *time_info = ::localtime(&now);
          int seconds = time_info->tm_sec;
          int minutes = time_info->tm_min;
          int hour = time_info->tm_hour;
          int day = time_info->tm_mday;
          int month = time_info->tm_mon + 1;
          int year = time_info->tm_year;
          year = year + 1900;
          int year1 = year - 2000;
          
          uint16_t reg22_value = (year1 << 8) | month;
          uint16_t reg23_value = (day << 8) | hour;
          uint16_t reg24_value = (minutes << 8) | seconds;
          
          if (year != 1970) {
            std::vector<uint16_t> rtc_data = {reg22_value, reg23_value, reg24_value};
            esphome::modbus_controller::ModbusCommandItem set_rtc_command =
                esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 22, rtc_data.size(), rtc_data);
            controller->queue_command(set_rtc_command);
            ESP_LOGI("Time Sync", "Seconds: %d, Minutes: %d, Hour: %d, Day: %d, Month: %d, Year: %d", seconds, minutes, hour, day, month, year);
          }

############################################### BINARY SENSORS ########################################
binary_sensor:
  - platform: homeassistant            # Manual Time sync. Create an input_boolean sensor in HA
    entity_id: input_boolean.sync_inverter_time
    name: "Sync Time"
    id: sync_time
    on_press:
      then:
        - lambda: |-
            esphome::modbus_controller::ModbusController *controller = id(inverter);
            time_t now = ::time(nullptr);
            struct tm *time_info = ::localtime(&now);
            int seconds = time_info->tm_sec;
            int minutes = time_info->tm_min;
            int hour = time_info->tm_hour;
            int day = time_info->tm_mday;
            int month = time_info->tm_mon + 1;
            int year = time_info->tm_year;
            year = year + 1900;
            int year1 = year - 2000;
            
            uint16_t reg22_value = (year1 << 8) | month;
            uint16_t reg23_value = (day << 8) | hour;
            uint16_t reg24_value = (minutes << 8) | seconds;
            
            if (year != 1970) {
              std::vector<uint16_t> rtc_data = {reg22_value, reg23_value, reg24_value};
              esphome::modbus_controller::ModbusCommandItem set_rtc_command =
                  esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 22, rtc_data.size(), rtc_data);
              controller->queue_command(set_rtc_command);
              ESP_LOGI("Time Sync", "Seconds: %d, Minutes: %d, Hour: %d, Day: %d, Month: %d, Year: %d", seconds, minutes, hour, day, month, year);
            }

 

  • Author
9 minutes ago, slipx said:

There are two approaches. Using a set interval or manual method using a toggle

#Set the interval to sync your inverter time with HA or comment out to disable 
interval:
  - interval: 3600s
    then:
      - lambda: |-
          esphome::modbus_controller::ModbusController *controller = id(inverter);
          time_t now = ::time(nullptr);
          struct tm *time_info = ::localtime(&now);
          int seconds = time_info->tm_sec;
          int minutes = time_info->tm_min;
          int hour = time_info->tm_hour;
          int day = time_info->tm_mday;
          int month = time_info->tm_mon + 1;
          int year = time_info->tm_year;
          year = year + 1900;
          int year1 = year - 2000;
          
          uint16_t reg22_value = (year1 << 8) | month;
          uint16_t reg23_value = (day << 8) | hour;
          uint16_t reg24_value = (minutes << 8) | seconds;
          
          if (year != 1970) {
            std::vector<uint16_t> rtc_data = {reg22_value, reg23_value, reg24_value};
            esphome::modbus_controller::ModbusCommandItem set_rtc_command =
                esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 22, rtc_data.size(), rtc_data);
            controller->queue_command(set_rtc_command);
            ESP_LOGI("Time Sync", "Seconds: %d, Minutes: %d, Hour: %d, Day: %d, Month: %d, Year: %d", seconds, minutes, hour, day, month, year);
          }

############################################### BINARY SENSORS ########################################
binary_sensor:
  - platform: homeassistant            # Manual Time sync. Create an input_boolean sensor in HA
    entity_id: input_boolean.sync_inverter_time
    name: "Sync Time"
    id: sync_time
    on_press:
      then:
        - lambda: |-
            esphome::modbus_controller::ModbusController *controller = id(inverter);
            time_t now = ::time(nullptr);
            struct tm *time_info = ::localtime(&now);
            int seconds = time_info->tm_sec;
            int minutes = time_info->tm_min;
            int hour = time_info->tm_hour;
            int day = time_info->tm_mday;
            int month = time_info->tm_mon + 1;
            int year = time_info->tm_year;
            year = year + 1900;
            int year1 = year - 2000;
            
            uint16_t reg22_value = (year1 << 8) | month;
            uint16_t reg23_value = (day << 8) | hour;
            uint16_t reg24_value = (minutes << 8) | seconds;
            
            if (year != 1970) {
              std::vector<uint16_t> rtc_data = {reg22_value, reg23_value, reg24_value};
              esphome::modbus_controller::ModbusCommandItem set_rtc_command =
                  esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 22, rtc_data.size(), rtc_data);
              controller->queue_command(set_rtc_command);
              ESP_LOGI("Time Sync", "Seconds: %d, Minutes: %d, Hour: %d, Day: %d, Month: %d, Year: %d", seconds, minutes, hour, day, month, year);
            }

 

Awesome stuff..

Gonna copy pasta this in :)

Thanks as always!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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.