diff --git a/CHANGELOG.md b/CHANGELOG.md index 086fed26..f4228b5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [2.2.3] - 2023-07-03 +### Fixed +- Fixed Charge_time_remaining device_class error + ## [2.2.2] - 2023-07-03 ### Fixed - Fixed charge target bug (Thanks S0ckhamster) diff --git a/GivTCP/read.py b/GivTCP/read.py index 3b5c90f4..dfdbd016 100644 --- a/GivTCP/read.py +++ b/GivTCP/read.py @@ -397,6 +397,11 @@ def getData(fullrefresh): # Read from Inverter put in cache # Battery Power Battery_power = GEInv.p_battery + if GiV_Settings.first_run: # Make sure that we publish the HA message for both Charge and Discharge times + power_output['Charge_Time_Remaining'] = 0 + power_output['Charge_Completion_Time'] = datetime.datetime.now().replace(tzinfo=GivLUT.timezone).isoformat() + power_output['Discharge_Time_Remaining'] = 0 + power_output['Discharge_Completion_Time'] = datetime.datetime.now().replace(tzinfo=GivLUT.timezone).isoformat() if Battery_power >= 0: discharge_power = abs(Battery_power) charge_power = 0 diff --git a/givtcp.yaml b/givtcp.yaml deleted file mode 100644 index 00c682c4..00000000 --- a/givtcp.yaml +++ /dev/null @@ -1,236 +0,0 @@ -sensor: - - platform: rest - name: GivTCP - resource: http://192.168.2.10:6345/runAll #GivTCP docker container connection - method: GET - scan_interval: 20 # refresh - timeout: 15 - value_template: 'Connected' - json_attributes: # define the entrys I want to retrieve - - Energy - - Power - - Invertor_Details - - Timeslots - - Control - - Battery_Details - -template: - - sensor: - - name: "GivTCP Import Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Import_Energy_Total_kWh'] }}" - - name: "GivTCP Export Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Export_Energy_Total_kWh'] }}" - - name: "GivTCP Battery Throughput Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Battery_Throughput_Total_kWh'] }}" - - name: "GivTCP AC Charge Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['AC_Charge_Energy_Total_kWh'] }}" - - name: "GivTCP Invertor Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Invertor_Energy_Total_kWh'] }}" - - name: "GivTCP PV Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['PV_Energy_Total_kWh'] }}" - - name: "GivTCP Load Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Load_Energy_Total_kWh'] }}" - - name: "GivTCP Battery Charge Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Battery_Charge_Energy_Total_kWh'] }}" - - name: "GivTCP Battery Discharge Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Battery_Discharge_Energy_Total_kWh'] }}" - - name: "GivTCP Self Consumption Energy Total" - unit_of_measurement: "kWh" - device_class: energy - state_class: total_increasing - state: "{{ state_attr('sensor.givtcp','Energy')['Total']['Self_Consumption_Energy_Total_kWh'] }}" - - - - name: "GivTCP Import Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Import_Energy_Today_kWh'] }}" - - name: "GivTCP Export Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Export_Energy_Today_kWh'] }}" - - name: "GivTCP Battery Throughput Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Battery_Throughput_Today_kWh'] }}" - - name: "GivTCP AC Charge Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['AC_Charge_Energy_Today_kWh'] }}" - - name: "GivTCP Invertor Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Invertor_Energy_Today_kWh'] }}" - - name: "GivTCP PV Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['PV_Energy_Today_kWh'] }}" - - name: "GivTCP Load Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Load_Energy_Today_kWh'] }}" - - name: "GivTCP Battery Charge Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Battery_Charge_Energy_Today_kWh'] }}" - - name: "GivTCP Battery Discharge Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Battery_Discharge_Energy_Today_kWh'] }}" - - name: "GivTCP Self Consumption Energy Today" - unit_of_measurement: "kWh" - device_class: energy - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Energy')['Today']['Self_Consumption_Energy_Today_kWh'] }}" - - - - name: "GivTCP PV Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['PV_Power'] }}" - - name: "GivTCP Grid Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Grid_Power'] }}" - - name: "GivTCP Import Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Import_Power'] }}" - - name: "GivTCP Export Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Export_Power'] }}" - - name: "GivTCP EPS Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['EPS_Power'] }}" - - name: "GivTCP Invertor Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Invertor_Power'] }}" - - name: "GivTCP Load Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Load_Power'] }}" - - name: "GivTCP Self Consumption Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Self_Consumption_Power'] }}" - - name: "GivTCP Battery Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Battery_Power'] }}" - - name: "GivTCP Battery Charge Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Charge_Power'] }}" - - name: "GivTCP Battery Discharge Power" - unit_of_measurement: "W" - device_class: power - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['Discharge_Power'] }}" - - - name: "GivTCP Battery SOC" - unit_of_measurement: "%" - device_class: battery - state_class: measurement - state: "{{ state_attr('sensor.givtcp','Power')['Power']['SOC'] }}" - - - - name: "GivTCP Control Mode" - state: "{{ state_attr('sensor.givtcp','Control')['Mode'] }}" - - name: "GivTCP Target Charge SOC" - state: "{{ state_attr('sensor.givtcp','Control')['Target_SOC'] }}" - unit_of_measurement: "%" - device_class: battery - state_class: measurement - - name: "GivTCP Battery Charge Rate" - state: "{{ state_attr('sensor.givtcp','Control')['Battery_Charge_Rate'] }}" - unit_of_measurement: "%" - - name: "GivTCP Battery Discharge Rate" - state: "{{ state_attr('sensor.givtcp','Control')['Battery_Discharge_Rate'] }}" - unit_of_measurement: "%" - - name: "GivTCP Invertor Temperature" - state: "{{ state_attr('sensor.givtcp','Invertor_Details')['Invertor_Temperature'] }}" - device_class: temperature - unit_of_measurement: "°C" - - - name: "GivTCP Charge Slot 1 Start" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Charge_start_time_slot_1'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" - - name: "GivTCP Charge Slot 1 End" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Charge_end_time_slot_1'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" - - name: "GivTCP Charge Slot 2 Start" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Charge_start_time_slot_2'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" - - name: "GivTCP Charge Slot 2 End" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Charge_end_time_slot_2'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" - - name: "GivTCP Discharge Slot 1 Start" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Discharge_start_time_slot_1'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" - - name: "GivTCP Discharge Slot 1 End" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Discharge_end_time_slot_1'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" - - name: "GivTCP Discharge Slot 2 Start" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Discharge_start_time_slot_2'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" - - name: "GivTCP Discharge Slot 2 End" - device_class: timestamp - state: "{{ strptime(state_attr('sensor.givtcp','Timeslots')['Discharge_end_time_slot_2'],'%H:%M:%S').replace(year=now().year,month=now().month,day=now().day).timestamp()|timestamp_local() }}" - icon: "mdi:calendar-clock" -