Component has object has no attribute 'lower' - Need some Python help

Hello,

I need some Python help. I was able to implement the python-maxcube-api with that code:

import logging

from homeassistant.components.climate import (PRECISION_TENTHS, STATE_COOL, STATE_HEAT, STATE_IDLE, ClimateDevice, PLATFORM_SCHEMA)
from homeassistant.const import (TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_TEMPERATURE)

from maxcube.connection import *
from maxcube.cube import *
from maxcube.device import *
from maxcube.thermostat import *

REQUIREMENTS = ['python-maxcube-api']

CONF_IP = 'ip'
CONF_PORT = 'port'
PROPERTY_SET_TEMPERATURE = 'SET_TEMPERATURE'
PROPERTY_ACTUAL_TEMPERATURE = 'ACTUAL_TEMPERATURE'
PROPERTY_MODE = 'MODE'

_LOGGER = logging.getLogger(__name__)

def setup_platform(hass, config, add_devices, discovery_info=None):

"""Setup the Max!Cube thermostat."""
devices = []
try:
    cubeConn = MaxCubeConnection("192.168.178.143", 62910)
    cube = MaxCube(cubeConn)
    for device in cube.get_devices():
        devices.append(MaxThermostat(cube, device.rf_address))
except socket.error:
    _LOGGER.exception("Connection error to Max!Cube")
    return False

add_devices(devices)
return True

# pylint: disable=too-many-instance-attributes
class MaxThermostat(ClimateDevice):
"""Representation of a Homematic thermostat."""

def __init__(self, cube, _id):
    """Initialize the thermostat."""
    self.cube = cube
    self._id = _id
    self._device = cube.device_by_rf(_id)

@property
def should_poll(self):
    """Polling needed for thermostat."""
    return True


@property
def name(self):
    """Return the name of the Homematic device."""
    return self._device.lower()

@property
def temperature_unit(self):
    """Return the unit of measurement."""
    return TEMP_CELSIUS

@property
def current_temperature(self):
    """Return the current temperature."""
    return self._device.actual_temperature

@property
def target_temperature(self):
    """Return the temperature we try to reach."""
    return self._device.target_temperature


def set_temperature(self, **kwargs):
    """Set new target temperature."""
    temperature = kwargs.get(ATTR_TEMPERATURE)
    self.cube.set_target_temperature(self._device, temperature)

@property
def device_state_attributes(self):
    """Return the device specific state attributes."""
    return {"mode": self._device.mode}

@property
def min_temp(self):
    """Return the minimum temperature."""
    return round(convert(4.5, TEMP_CELSIUS, self.unit_of_measurement))

@property
def max_temp(self):
    """Return the maximum temperature."""
    return round(convert(30.5, TEMP_CELSIUS, self.unit_of_measurement))


def update(self):
    """Update the data from the thermostat."""
    try:
        self.cube.update()
    except socket.error:
        _LOGGER.exception("Did not receive any temperature data from the "
                          "Max!Cube API.")

Suddenly it stopped working with these errors. I assume due to a HomeAssistant update:

16-12-23 13:15:23 homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py”, line 335, in _async_process_entity
new_entity, self, update_before_add=update_before_add
File “/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py”, line 185, in async_add_entity
object_id = entity.name or DEVICE_DEFAULT_NAME
File “/etc/homeassistant/staging/custom_components/climate/max.py”, line 56, in name
return self._device.lower()
AttributeError: ‘MaxThermostat’ object has no attribute ‘lower’

Can anybody help me how to solve this?

Solved. Unfortunately it seems that I cannot delete my own thread.

Hi @HA_Rookie, this is old. do you mind sharing what was the issue? I am running on a similar issue and I have no clue. thanks.