Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BT stopped working with 1.5.1, Invalid state length #1357

Open
2 of 3 tasks
gmdfalk opened this issue May 19, 2024 · 8 comments
Open
2 of 3 tasks

BT stopped working with 1.5.1, Invalid state length #1357

gmdfalk opened this issue May 19, 2024 · 8 comments
Assignees
Labels
new bug incoming bug issue

Comments

@gmdfalk
Copy link

gmdfalk commented May 19, 2024

Prerequisites

  • Model name of your Devices
    Sonoff TRZVB (https://www.zigbee2mqtt.io/devices/TRVZB.html#sonoff-trvzb), Firmare 1.1.5
  • Output from Home Assistant Developer Tools state e.g.
  • Output from Home Assistant Device Diagnostic from BT
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.5.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.6.28-haos-raspi",
    "supervisor": "2024.05.1",
    "host_os": "Home Assistant OS 12.3",
    "docker_version": "25.0.5",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "better_thermostat": {
      "documentation": "https://github.com/KartoffelToby/better_thermostat",
      "version": "1.5.1",
      "requirements": []
    },
    "hacs": {
      "documentation": "https://hacs.xyz/docs/configuration/start",
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "better_thermostat",
    "name": "Better Thermostat",
    "after_dependencies": [
      "climate"
    ],
    "codeowners": [
      "@kartoffeltoby"
    ],
    "config_flow": true,
    "dependencies": [
      "climate",
      "recorder"
    ],
    "documentation": "https://github.com/KartoffelToby/better_thermostat",
    "iot_class": "local_push",
    "issue_tracker": "https://github.com/KartoffelToby/better_thermostat/issues",
    "requirements": [],
    "version": "1.5.1",
    "is_built_in": false
  },
  "data": {
    "info": {
      "name": "better_thermostat_dg_ankleide",
      "temperature_sensor": "sensor.temperature_sensor_dg_ankleide_temperature",
      "off_temperature": 18,
      "tolerance": 0.5,
      "target_temp_step": 0.0,
      "humidity_sensor": "sensor.temperature_sensor_dg_ankleide_humidity",
      "outdoor_sensor": "sensor.temperature_sensor_eg_terrasse_temperature",
      "window_sensors": "binary_sensor.contact_sensor_dg_ankleide_contact",
      "weather": "weather.openweathermap",
      "window_off_delay": 30,
      "window_off_delay_after": 30,
      "cooler": null,
      "model": "TRVZB"
    },
    "thermostat": {
      "climate.thermostat_dg_ankleide": {
        "name": "thermostat.dg_ankleide",
        "state": "off",
        "attributes": {
          "hvac_modes": [
            "off",
            "auto",
            "heat"
          ],
          "min_temp": 4.0,
          "max_temp": 35.0,
          "target_temp_step": 0.5,
          "current_temperature": 22.1,
          "temperature": 7.0,
          "hvac_action": "idle",
          "battery": 97,
          "battery_low": null,
          "child_lock": "UNLOCK",
          "closing_steps": 354,
          "frost_protection_temperature": 7,
          "idle_steps": 243,
          "linkquality": 94,
          "local_temperature": 22.1,
          "local_temperature_calibration": -0.2,
          "occupied_heating_setpoint": 7,
          "open_window": "OFF",
          "running_state": "idle",
          "system_mode": "off",
          "update": {
            "installed_version": 4357,
            "latest_version": 4357,
            "state": "idle"
          },
          "update_available": null,
          "valve_closing_degree": 100,
          "valve_closing_limit_voltage": 2700,
          "valve_motor_running_voltage": 1338,
          "valve_opening_degree": 100,
          "valve_opening_limit_voltage": 1303,
          "weekly_schedule": {
            "friday": "00:00/16 07:00/19 10:00/16 10:00/16 17:00/19 23:00/16",
            "monday": "00:00/16 07:00/19 10:00/16 10:00/16 17:00/19 23:00/16",
            "saturday": "00:00/16 07:00/19 10:00/19 10:00/19 10:00/19 23:00/16",
            "sunday": "00:00/16 07:00/19 10:00/19 10:00/19 10:00/19 23:00/16",
            "thursday": "00:00/16 07:00/19 10:00/16 10:00/16 17:00/19 23:00/16",
            "tuesday": "00:00/16 07:00/19 10:00/16 10:00/16 17:00/19 23:00/16",
            "wednesday": "00:00/16 07:00/19 10:00/16 10:00/16 17:00/19 23:00/16"
          },
          "friendly_name": "thermostat.dg_ankleide",
          "supported_features": 385
        },
        "bt_config": {
          "calibration": "target_temp_based",
          "calibration_mode": "fix_calibration",
          "protect_overheating": false,
          "no_off_system_mode": false,
          "heat_auto_swapped": false,
          "child_lock": false,
          "homaticip": false
        },
        "bt_adapter": "mqtt",
        "bt_integration": "mqtt",
        "model": "TRVZB"
      }
    },
    "external_temperature_sensor": {
      "entity_id": "sensor.temperature_sensor_dg_ankleide_temperature",
      "state": "18.23",
      "attributes": {
        "state_class": "measurement",
        "battery": 83,
        "humidity": 50.84,
        "linkquality": 83,
        "power_outage_count": 13,
        "pressure": 1010,
        "temperature": 18.23,
        "voltage": 2975,
        "unit_of_measurement": "\u00b0C",
        "device_class": "temperature",
        "friendly_name": "temperature_sensor.dg_ankleide Temperature"
      },
      "last_changed": "2024-05-18T04:11:05.300950+00:00",
      "last_reported": "2024-05-18T04:11:05.300950+00:00",
      "last_updated": "2024-05-18T04:11:05.300950+00:00",
      "context": {
        "id": "01HY4YAV6MVZ6RHRSGBKEGGM7R",
        "parent_id": null,
        "user_id": null
      }
    },
    "window_sensor": {
      "entity_id": "binary_sensor.contact_sensor_dg_ankleide_contact",
      "state": "off",
      "attributes": {
        "battery": 100,
        "contact": true,
        "device_temperature": 25,
        "linkquality": 123,
        "power_outage_count": 108,
        "trigger_count": 0,
        "voltage": 3015,
        "device_class": "door",
        "friendly_name": "contact_sensor.dg_ankleide Door"
      },
      "last_changed": "2024-05-18T04:11:04.293851+00:00",
      "last_reported": "2024-05-18T04:11:04.293851+00:00",
      "last_updated": "2024-05-18T04:11:04.293851+00:00",
      "context": {
        "id": "01HY4YAT75XAV23ZBGF08A2FS6",
        "parent_id": null,
        "user_id": null
      }
    }
  }
}

Description

BT stopped working for me a few weeks ago. Around that time i updated BT to 1.5.1 and HA Core 2024.5.x. So either of those updates might have caused this.
Downgrading to BT 1.5.0 works for me to restore functionality, although the error still appears.
I've reset the _local_temperature_calibration entity to 0, no idea how they ended up with values out of range.

These are the BT error logs i see in the system logs:

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:1203
First occurred: May 18, 2024 at 06:11:04 (696 occurrences)
Last logged: 10:27:55

Failed to set state for sensor.thermostat_dg_bad_weekly_schedule, fall back to unknown
Failed to set state for sensor.thermostat_eg_wohnzimmer_couch_weekly_schedule, fall back to unknown
Failed to set state for sensor.thermostat_dg_schlafzimmer_weekly_schedule, fall back to unknown
Failed to set state for sensor.thermostat_eg_eingang_weekly_schedule, fall back to unknown
Failed to set state for sensor.thermostat_og_bad_weekly_schedule, fall back to unknown
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1203, in _async_write_ha_state
    hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2310, in async_set
    state = State(
            ^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1788, in __init__
    validate_state(state)
  File "/usr/src/homeassistant/homeassistant/core.py", line 228, in validate_state
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state with length 477. State max length is 255 characters.
Logger: homeassistant.components.mqtt.number
Source: components/mqtt/number.py:195
integration: MQTT (documentation, issues)
First occurred: May 18, 2024 at 06:11:04 (279 occurrences)
Last logged: 10:21:30

Invalid value for number.thermostat_eg_wohnzimmer_couch_local_temperature_calibration: 11.6 (range -7.0 - 7.0)
Invalid value for number.thermostat_dg_schlafzimmer_local_temperature_calibration: 11.6 (range -7.0 - 7.0)
Invalid value for number.thermostat_dg_bad_local_temperature_calibration: 11.6 (range -7.0 - 7.0)

I also get the warning reporter here: #1347

Versions

BT 1.5.1
Core 2024.5.4
Operating System 12.3

@gmdfalk gmdfalk added the new bug incoming bug issue label May 19, 2024
@gmdfalk gmdfalk changed the title BT stopped working with HA 2024.5.0, Invalid state length BT stopped working, Invalid state length May 19, 2024
@gmdfalk gmdfalk changed the title BT stopped working, Invalid state length BT stopped working with 1.5.1, Invalid state length May 19, 2024
@Loeffelmaster
Copy link

I have the same Problem, haven't checked my thermostat and it shows unavailable even though it is available in Z2M.
I checked the data and it failed at 9th of may, when I updated to 2024.5.0.
As there where many changes in MQTT and since then every version corrected values in MQTT (same timings not working correctly) I haven't updated further more until they fix the MQTT timing.

Could that be correlated?

The firmware version of my Sonoff TRVZB is 1.1.5

@hilburn
Copy link

hilburn commented May 27, 2024

You need to disable the weekly_schedule sensor for your TRV and it fixes the behaviour
I've tried talking to both the z2m and homeassistant people and neither of them accept responsibility for fixing this

@Loeffelmaster
Copy link

You need to disable the weekly_schedule sensor for your TRV and it fixes the behaviour I've tried talking to both the z2m and homeassistant people and neither of them accept responsibility for fixing this

I have disabled the weekly_schedule sensor, afterwards I fully restarted my HA computer. The thermostat is still unavailable. How can I make it available again? Disabling the sensor isn't enough it seems.

@Ey3scr34m
Copy link

You need to disable the weekly_schedule sensor for your TRV and it fixes the behaviour I've tried talking to both the z2m and homeassistant people and neither of them accept responsibility for fixing this

I have the same problem. Where do I disable the weekly_schedule?

@Loeffelmaster
Copy link

You need to disable the weekly_schedule sensor for your TRV and it fixes the behaviour I've tried talking to both the z2m and homeassistant people and neither of them accept responsibility for fixing this

I have the same problem. Where do I disable the weekly_schedule?

Settings => Integrations, etc. => Entities
Search for weekly and you will find it.

@Loeffelmaster
Copy link

You need to disable the weekly_schedule sensor for your TRV and it fixes the behaviour I've tried talking to both the z2m and homeassistant people and neither of them accept responsibility for fixing this

I have the same problem. Where do I disable the weekly_schedule?

But for me that didn't changed anything, I've even reconfigured BetterThermostat nothing changes. New start, whatever I do, the TRV stays unavailable in BT. In Z2M it is online and can be controlled without a problem.
So I hope for you, that it helps in your case. On my system it didn't change anything.

@Ey3scr34m
Copy link

You need to disable the weekly_schedule sensor for your TRV and it fixes the behaviour I've tried talking to both the z2m and homeassistant people and neither of them accept responsibility for fixing this

I have the same problem. Where do I disable the weekly_schedule?

Settings => Integrations, etc. => Entities Search for weekly and you will find it.

Well that's what I did before asking here and I couldn't find anything. Maybe my TRVs don't have it? I got the Bosch TRV II.

@stevenbuehner
Copy link

You need to disable the weekly_schedule sensor for your TRV and it fixes the behaviour I've tried talking to both the z2m and homeassistant people and neither of them accept responsibility for fixing this

I have the same problem. Where do I disable the weekly_schedule?

Settings => Integrations, etc. => Entities Search for weekly and you will find it.

Well that's what I did before asking here and I couldn't find anything. Maybe my TRVs don't have it? I got the Bosch TRV II.

I am having exact the same problems. Also with Bosch TRV 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new bug incoming bug issue
Projects
None yet
Development

No branches or pull requests

6 participants