Bang Bang Climate Controller, nan target temperatures

I have an esp32 minding my Daly BMS and have recently added a low wattage heat mat to the large battery box. I am attempting to use the Bang Bang Climate Controller to switch the heat mat on and off.

Sadly the default_target_temperature_low and default_target_temperature_high are being reported in the logs as nan

What have I missed or done incorrectly?

climate:
  - platform: bang_bang # can add cooling fan to this using cool_action
    name: "Battery Box Warmer"
    sensor: battery_temperature_1
    default_target_temperature_low: 13 °C
    default_target_temperature_high: 17 °C
    visual:
      min_temperature: -5 °C
      max_temperature: 45 °C
      temperature_step: 
        target_temperature: 1
        current_temperature: 1      

    heat_action:
      - if:
          condition:
            and:
              - lambda: 'return id(battery_level).state >= 25;'
              - lambda: 'return id(min_cell_voltage).state >= 3.201;'
          then:
            - switch.turn_on: battery_warmer
    idle_action:
      - switch.turn_off: battery_warmer

# Automation to turn off the warmer if battery level or cell voltage drops below threshold
interval:
  - interval: 10s
    then:
      - if:
          condition:
            or:
              - lambda: 'return id(battery_level).state < 25;'
              - lambda: 'return id(min_cell_voltage).state < 3.201;'
          then:
            - switch.turn_off: battery_warmer
[12:02:51][D][sensor:094]: 'Temperature 1': Sending state 12.00000 °C with 0 decimals of accuracy
[12:02:51][D][climate:396]: 'Battery Box Warmer' - Sending state:
[12:02:51][D][climate:399]:   Mode: HEAT
[12:02:51][D][climate:401]:   Action: OFF
[12:02:51][D][climate:419]:   Current Temperature: 12.00°C
[12:02:51][D][climate:423]:   Target Temperature: Low: nan°C High: nan°C

I am only guessing, but I see min_temperature and max_temperature are supposed to be reals floats. Maybe try

   min_temperature: -5.0 °C

etc

I realize this doesn’t accord with the example in the docs, with a try though.

Your YAML converted to JSON looks like:

{
  "climate": [
    {
      "platform": "bang_bang",
      "name": "Battery Box Warmer",
      "sensor": "battery_temperature_1",
      "default_target_temperature_low": "13 °C",
      "default_target_temperature_high": "17 °C",
      "visual": {
        "min_temperature": "-5 °C",
        "max_temperature": "45 °C",
        "temperature_step": {
          "target_temperature": 1,
          "current_temperature": 1
        }
      }
    }
  ]
}

Notice that your min and max temperatures are actually strings and not numbers. The validation for the component should have flagged that for you. Remove the °C from your values and they will be numbers, which should work.

Again, the docs say they should be like that (although it seems wrong to me).

# Example configuration entry
climate:
  - platform: bang_bang
    name: "Bang Bang Climate Controller"
    sensor: my_temperature_sensor
    default_target_temperature_low: 20 °C
    default_target_temperature_high: 22 °C

    heat_action:
      - switch.turn_on: heater
    idle_action:
      - switch.turn_off: heater

From https://esphome.io/components/climate/bang_bang

The docs also say:

default_target_temperature_high (Required, float):

When you do it the way you did you get NaN, which could be true for the string you provided depending on the way you interpret it.

Did you try changing it like I suggested?

I had tried that previously but have just tried again to no avail.

Not being able ot find a solution the other day I changed to using the Thermostat controller instead. That works but would prefer to use the bang bang…

Your YAML clearly shows that you did NOT remove the suffix, so you are providing a string where a number is needed.

try this:

- platform: bang_bang # can add cooling fan to this using cool_action
    name: "Battery Box Warmer"
    sensor: battery_temperature_1
    default_target_temperature_low: 13
    default_target_temperature_high: 17
    visual:
      min_temperature: -5
      max_temperature: 45
      temperature_step: 
        target_temperature: 1
        current_temperature: 1

My previous reply was a misquote, apologies.

I HAVE tried without the suffix and it does not work for me.