You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get the home assistant sensor working, but I keep getting the following error:
Error while setting up platform sure_petflap Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/hass/.homeassistant/custom_components/sensor/sure_petflap.py", line 59, in setup_platform username = config.get(CONF_USERNAME) NameError: name 'CONF_USERNAME' is not defined
I'm not sure what goes wrong. The code looks alright. I'm running hass 0.80.2. any Ideas?
The text was updated successfully, but these errors were encountered:
I think the eval under def is_hass_component(): is not working. As a hack, I commented out that block, commented the if start/stop, updated the indentation for the remaining lines within the if, and then commented everything in the else block.
#def is_hass_component():
# try:
# import homeasssistant
# return True
# except ImportError:
# return False
#if is_hass_component():
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD)
import homeassistant.helpers.config_validation as cv
from deps.sure_petcare import SurePetFlap
from deps.sure_petcare.utils import gen_device_id
import voluptuous as vol
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
})
#else:
# Assume not running within home assistant. This *does* mean that you
# won't be able to run this test script if you have homeassistant
# installed but, if you do, you're probably running (or can run) this
# component from within hass anyway.
# from sure_petcare import SurePetFlap
# from sure_petcare.utils import gen_device_id
# dummy dependencies
# class Entity( object ):
# pass
# def Throttle( *args, **kwargs ):
# def decorator( f ):
# return f
# return decorator
I plan on returning to this shortly to figure out a permanent fix.
Nice work on the surepet support!
I'm trying to get the home assistant sensor working, but I keep getting the following error:
Error while setting up platform sure_petflap Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/hass/.homeassistant/custom_components/sensor/sure_petflap.py", line 59, in setup_platform username = config.get(CONF_USERNAME) NameError: name 'CONF_USERNAME' is not defined
I'm not sure what goes wrong. The code looks alright. I'm running hass 0.80.2. any Ideas?
The text was updated successfully, but these errors were encountered: