I did a little debugging and first I verified that the modules required for each of the programs in the stack trace were on my machine and they were.
Then I decided to add a couple of debug statements in the component program opensprinkler.py:
server = conf.get(CONF_HOST)
port = conf.get(CONF_PORT)
password = conf.get(CONF_PASSWORD)
_LOGGER.warning("password string: %s", password)
server += ":"+port
_LOGGER.warning("server string: %s", server)
hass.data[DATA_OPENSPRINKLER] = OpenSprinklerData(server, password)
_LOGGER.warning("hass.data[] string: %s", hass.data[DATA_OPENSPRINKLER])
Everything looks fine in the log file (I have the password in MD5 hash lower case but I’ve removed it in this paste)
2018-02-28 18:25:03 WARNING (SyncWorker_7) [custom_components.opensprinkler] password string: xxXXxx
2018-02-28 18:25:03 WARNING (SyncWorker_7) [custom_components.opensprinkler] server string: 192.168.10.230:8080
2018-02-28 18:25:03 WARNING (SyncWorker_7) [custom_components.opensprinkler] hass.data[] string: <custom_components.opensprinkler.OpenSprinklerData object at 0x0630D570>
2018-02-28 18:25:04 ERROR (MainThread) [homeassistant.setup] Error during setup of component opensprinkler
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\homeassistant\setup.py", line 148, in _async_setup_component
component.setup, hass, processed_config)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\asyncio\futures.py", line 327, in __iter__
yield self # This tells Task to wait for completion.
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\asyncio\tasks.py", line 250, in _wakeup
future.result()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\asyncio\futures.py", line 243, in result
raise self._exception
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\concurrent\futures\thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\Administrator\AppData\Roaming\.homeassistant\custom_components\opensprinkler.py", line 66, in setup
hass.data[DATA_OPENSPRINKLER].update()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\homeassistant\util\__init__.py", line 306, in wrapper
result = method(*args, **kwargs)
File "C:\Users\Administrator\AppData\Roaming\.homeassistant\custom_components\opensprinkler.py", line 133, in update
api_dict['data'] = parse_api_data(json.loads(response.text, object_pairs_hook=OrderedDict))
File "C:\Users\Administrator\AppData\Roaming\.homeassistant\custom_components\opensprinkler.py", line 252, in parse_api_data
programs = response['programs']['pd']
KeyError: 'programs'
2018-02-28 18:25:04 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.opensprinkler. Setup failed for dependencies: opensprinkler
2018-02-28 18:25:04 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.opensprinkler: Could not setup all dependencies.
I’ll keep poking but hopefully someone more experienced in Python can help out.
…with line 129 logger warning enabled I can see the response is:
2018-02-28 18:39:50 WARNING (SyncWorker_6) [custom_components.opensprinkler] response: {"fwv":217}
So I’m getting a response from opensprinkler but is this the first expected response?