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.

Ivan_E

Members
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    Ivan_E reacted to slipx in ModBus Question   
    Just checked and according  to the documentation if you are using the homeassistant platform it uses the api connection.
    With the homeassistant time platform, the native API connection to Home Assistant will be used to periodically synchronize the current time.  
     
     
  2. Like
    Ivan_E reacted to slipx in ModBus Question   
    You can also trigger a manual sync by creating an input_boolean sensor i.e input_boolean.sync_inverter_time in HA and then adding it as a binary sensor. Whenever the toggle is turned on the action will run
    binary_sensor: - platform: homeassistant 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); }  
  3. Like
    Ivan_E reacted to slipx in ModBus Question   
    @Ivan_E I've updated my ESPHome config to include time synchronization with HA. You can download from the GitHub repo or add the code below (remember to use your own modbus id). For now its a simple interval based update. You can set the interval to whatever suits you. 
     
    #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);           }  
  4. Like
    Ivan_E reacted to p_i in ModBus Question   
    @Ivan_E see my sample node-red flow too. I've edited my previous post to add it.
  5. Like
    Ivan_E reacted to p_i in ModBus Question   
    x % y = the remainder when you divide x by y. In the example above, 6147 = 24*256 + 3.
    Just trust me, node-red knows what to do with that. 😉
  6. Like
    Region 2 ? 
    global.set("SS.url.i1.battery", global.get("SS.url.hostname") + "/api/v1/inverter/battery/" + global.get("SS.Invertor1sn") + "/realtime?sn=" + global.get("SS.Invertor1sn") + "&lan");   That is the url that is build to retrieve battery data. We dont embed a "time" to get data for. We request the latest available  You will probably find Region 2 server has a time quirk now that daylight savings has come in.    The bug I was referring to above was when some totals just stop "running" and then catch up hours later. 
  7. Like
    Ivan_E got a reaction from caswell1000 in My Sunsynk 8Kw & data collection setup   
    Ah OK, if I am seeing Errors like this
    [23:46:01][W][modbus_controller:113]: Duplicate modbus command found: type=0x3 address=154 count=1
    [23:46:01][W][modbus_controller:113]: Duplicate modbus command found: type=0x3 address=160 count=1
    [23:46:01][W][modbus_controller:113]: Duplicate modbus command found: type=0x3 address=164 count=1
    and 
    [23:46:05][D][modbus_controller:032]: Modbus command to device=1 register=0xA0 countdown=0 no response received - removed from send queue
    [23:46:06][D][modbus_controller:032]: Modbus command to device=1 register=0xA4 countdown=0 no response received - removed from send queue
    [23:46:08][D][modbus_controller:032]: Modbus command to device=1 register=0xA6 countdown=0 no response received - removed from send queue
    Is this a wiring issue or sensor issue please?
    Thanks Ivan

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.