nervetattoo / simple-thermostat

A different take on the thermostat card for Home Assistant ♨️
MIT License
746 stars 111 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'attributes').com #305

Open garyak opened 2 years ago

garyak commented 2 years ago

Describe the bug Error appears in HA log for 2021.12.6. No visible issues with the operation or rendering of the card.

2021-12-29 09:48:12 ERROR (MainThread) [frontend.js.latest.202112270] http://homeassistant.local:8123/hacsfiles/simple-thermostat/simple-thermostat.js?hacstag=158654878243:285:19980 Uncaught TypeError: Cannot read properties of undefined (reading 'attributes')

Card Config:

control:
  hvac:
    auto:
      icon: mdi:auto-fix
      name: Auto
    cool:
      icon: mdi:snowflake
      name: Cool
    heat:
      icon: mdi:fire
      name: Heat
    'off':
      icon: mdi:power
      name: 'Off'
    dry: false
  fan:
    auto:
      name: auto
    circulate:
      icon: mdi:restore
      name: circulate
    'on':
      icon: mdi:fan
      name: 'On'
decimals: '0'
fallback: 'Off'
icon: false
sensors:
  - attribute: current_humidity
    name: Humidity
    unit: ' %'
step_size: '1'
setpoints:
  temperature:
    hide: false
  target_temp_low:
    hide: true
  target_temp_high:
    hide: true
type: custom:simple-thermostat
layout:
  mode:
    names: false
    headings: false
    icons: true
entity: climate.south_zone_1
header:
  name: Kitchen

stsat

nelsonamen commented 2 years ago

+1

bokub commented 10 months ago

This bug may come from the following line:

https://github.com/nervetattoo/simple-thermostat/blob/eb0c0d5902a4a1e51d4ae3849417ea3eef7b8886/src/config/header.ts#L71

entity is undefined

image

This means that the entity defined in your card configuration doesn't exist