Page 1 of 1
Missing Sensor
Posted: Fri Feb 07, 2025 11:22 am
by HughInDevon
Hi,
I am using the NathanMarlor HA integration, version 1.13.4 (Thanks Dave!) which shows 81 entities. The ones I need for my automation project are the two associated settings for force discharge mode. I can access the Force Discharge Power, number.kh10_inverter_force_discharge_power but for the life of me I cannot find the Force Discharge Soc.
My KH10 inverter firmware versions are:
(ARM) Manager (KH10_Inverter) 1.22
Master (KH10_Inverter) 1.39
Slave (KH10_Inverter) 1.01
Maybe the ARM version is too old to show the FDSoc entity but it's odd that the FDPwr entity is present but not the other. Am I missing something?
Thanks,
Hugh
Re: Missing Sensor
Posted: Mon Feb 10, 2025 9:43 am
by WyndStryke
Some of the registers relating to force charge / discharge slots in the mode scheduler aren't readable on the KH inverters (not sure about other inverters), so the integration has no way to know.
I don't know if they are writeable however (i.e., write-only), or simply inaccessible entirely.
I implemented this in my own crude scheduler by simply monitoring the battery_soc myself and changing the work mode when the target was reached.
Re: Missing Sensor
Posted: Mon Feb 10, 2025 9:55 am
by HughInDevon
Thanks for the clarification. I have also devised my own, very crude, automation to use the normal battery soc to switch work modes. A shame that FDSoc isn’t exposed as it would be an elegant way to do it. Meanwhile I need to find out why my work mode switching away from Force Discharge failed and thus exported full, freshly charged, battery at 05:30 yesterday morning.
Re: Missing Sensor
Posted: Mon Feb 10, 2025 10:44 am
by WyndStryke
My automation to turn off force discharge looks like this (very crude as mentioned

), it will be called every few minutes, plus whenever the battery soc etc changes. It has a specific section which looks to see if Force Discharge is running between 7am (when the cheap period finishes) and 9am and turns it off if so. In the afternoon/evening it will gradually let the battery draw down, alternating with a slow force discharge. During the day it will usually swap to Feed-in first, unless I'm doing a calibration run and need solar to top up to the target.
Lots of things I'd like to clean up, for example running the SoC targets from a list rather than hard wiring them into each automation, and merging the automations into a single one rather than having a different automation for each workmode.
Code: Select all
alias: FoxESS Feed-in default during the day
description: ""
triggers:
- trigger: time_pattern
minutes: /15
- trigger: state
entity_id:
- input_boolean.eon_next_drive_cheap_period
to: "on"
- trigger: state
entity_id:
- sensor.battery_soc
- trigger: state
entity_id:
- input_boolean.foxess_calibrate_top_reached
to: "on"
- trigger: state
entity_id:
- input_boolean.foxess_calibrate_bottom_reached
to: "on"
conditions:
- condition: time
after: "07:00:00"
before: "23:59:59"
- condition: not
conditions:
- condition: state
entity_id: select.work_mode
state: Feed-in First
- condition: or
conditions:
- condition: not
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 55
seconds: 0
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.battery_soc
below: input_number.foxess_calibrate_bottom_soc
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.battery_soc
below: 21
- condition: or
conditions:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- sun
- condition: state
entity_id: input_boolean.foxess_calibrate_bottom_reached
state: "on"
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 15
seconds: 0
- condition: time
before: "23:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 26
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 20
seconds: 0
- condition: time
before: "23:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 31
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "22:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 36
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "22:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 41
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "21:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 44
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "21:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 47
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "20:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 51
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "20:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 55
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "19:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 58
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "19:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 61
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "18:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 64
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "18:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 68
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "17:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 71
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "17:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 73
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "16:30:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 75
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
for:
hours: 0
minutes: 25
seconds: 0
- condition: time
before: "16:00:00"
- condition: numeric_state
entity_id: sensor.battery_soc
below: 78
- condition: and
conditions:
- condition: state
entity_id: select.work_mode
state: Force Discharge
- condition: time
before: "09:00:00"
after: "07:00:00"
actions:
- action: select.select_option
metadata: {}
data:
option: Feed-in First
target:
entity_id: select.work_mode
- choose:
- conditions:
- condition: state
entity_id: input_boolean.foxess_calibrate_today
state: "on"
- condition: state
entity_id: input_boolean.foxess_calibrate_top_reached
state: "off"
- condition: template
value_template: >-
{{ states('sensor.solcast_pv_forecast_forecast_remaining_today')|
float > ((100.0 - (states('sensor.battery_Soc') | float)) *
(states('sensor.bms_kwh_remaining') | float) / 100.0 ) }}
sequence:
- action: select.select_option
metadata: {}
data:
option: Self Use
target:
entity_id: select.work_mode
default:
- action: select.select_option
metadata: {}
data:
option: Feed-in First
target:
entity_id: select.work_mode
mode: single
Re: Missing Sensor
Posted: Mon Feb 10, 2025 11:15 am
by HughInDevon
Hi,
Thanks for the code. Looks very interesting! I will happily post mine when I finally get it working. Which I can't do just at the moment as good 'ol Fox are updating my firmware!
