Hi @Justin_Young,
no worries, your nose points in the right direction:
You’re absolutely right: For now you need to have pyfujitseu folder in site-packages.
The pyfujitseu-package is starting to load on your system, but breaks within my new swing mode implementation. We seem to have different types of Fujitsu-ACs with different swing mode APIs. I added a fallback to the pyfujitseu code and created a new release for you here: https://github.com/xerxes87/pyfujitseu/releases/tag/0.9.2.8
I added the code into /config/deps/lib/python3.7/site-packages/pyfujitsu/ and as far as I can tell everything else appears to work if I change the region I receive a logon error which would be expected as I’m in Australia which uses the US settings I believe.
I’m stuck on the token.txt which appears is not created automatically and I cannot find where to place a blank token.txt file.
Any help would be appreciated.
Error while setting up platform fujitsu_general_heatpump
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 149, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 77, in setup_platform
if not fglairapi._authenticate():
File "/config/deps/lib/python3.7/site-packages/pyfujitsu/api.py", line 118, in _authenticate
f = open(self._ACCESS_TOKEN_FILE, "w")
FileNotFoundError: [Errno 2] No such file or directory: '/home/homeassistant/token.txt'
Same as @Justin_Young I now get the following errors
Log Details (ERROR)
Wed Aug 14 2019 08:10:12 GMT+1000 (Australian Eastern Standard Time)
Error while setting up platform fujitsu_general_heatpump
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 149, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 84, in setup_platform
add_entities(FujitsuClimate(fglairapi, dsn) for dsn in devices)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 198, in _schedule_add_entities
list(new_entities),
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 84, in <genexpr>
add_entities(FujitsuClimate(fglairapi, dsn) for dsn in devices)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 106, in __init__
self._swing_mode = self.swing_mode
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 195, in swing_mode
return self._fujitsu_device.get_swing_mode_desc()
File "/config/deps/lib/python3.7/site-packages/pyfujitsu/splitAC.py", line 141, in get_swing_mode_desc
if not isinstance(self.af_vertical_direction['value'],int):
TypeError: 'NoneType' object is not subscriptable
Just tested the new code. Still getting an error, but it’s a bit different.
Error while setting up platform fujitsu_general_heatpump
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 149, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 84, in setup_platform
add_entities(FujitsuClimate(fglairapi, dsn) for dsn in devices)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 198, in _schedule_add_entities
list(new_entities),
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 84, in <genexpr>
add_entities(FujitsuClimate(fglairapi, dsn) for dsn in devices)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 106, in __init__
self._swing_mode = self.swing_mode
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 195, in swing_mode
return self._fujitsu_device.get_swing_mode_desc()
File "/config/deps/lib/python3.7/site-packages/pyfujitsu/splitAC.py", line 141, in get_swing_mode_desc
if not isinstance(self.af_vertical_direction['value'],int):
TypeError: 'NoneType' object is not subscriptable
Error while setting up platform fujitsu_general_heatpump
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 149, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 84, in setup_platform
add_entities(FujitsuClimate(fglairapi, dsn) for dsn in devices)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 198, in _schedule_add_entities
list(new_entities),
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 84, in <genexpr>
add_entities(FujitsuClimate(fglairapi, dsn) for dsn in devices)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 106, in __init__
self._swing_mode = self.swing_mode
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 195, in swing_mode
return self._fujitsu_device.get_swing_mode_desc()
File "/config/deps/lib/python3.7/site-packages/pyfujitsu/splitAC.py", line 145, in get_swing_mode_desc
if self.af_vertical_direction['value'] is not None:
TypeError: 'NoneType' object is not subscriptable
@philwilldo you legend its getting closer, have been able to start the A/C via HA. All functions appear to work except swing mode which generates an error.
Wed Aug 14 2019 18:05:15 GMT+1000 (Australian Eastern Standard Time)
'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 128, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 210, in handle_service
self._platforms.values(), func, call, service_name, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 334, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 356, in _handle_service_platform_call
await getattr(entity, func)(**data)
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 424, in async_set_swing_mode
await self.hass.async_add_executor_job(self.set_swing_mode, swing_mode)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 204, in set_swing_mode
self._fujitsu_device.changeSwingMode(swing_mode)
File "/config/deps/lib/python3.7/site-packages/pyfujitsu/splitAC.py", line 125, in changeSwingMode
self.af_vertical_direction = 1
File "/config/deps/lib/python3.7/site-packages/pyfujitsu/splitAC.py", line 335, in af_vertical_direction
self._api._set_device_property(self.af_vertical_direction['key'],properties)
TypeError: 'NoneType' object is not subscriptable
The swing mode function was part of my new implementation and perfectly works perfectly well with my AC model, but produced (most of) the errors you and @Justin_Young had.
I can not give you much more support here, because the swing mode interface on your model seems to be different than mine.
But I will add an config option here to disable swing mode on UI for all users having a unsupported model.
It’s now working for me as well. Initially it did seem that there were some issues changing the operation mode, but that seems to have come right for me. I found that once I had turned on the unit with a particular operation mode it wouldn’t let me change it, but this morning on a different browser it seems to be working okay.
Regarding the swing mode, that was not working for me in the old version either. We may need some input from @Mmodarre about how he reverse engineered the API.
Hi @philwilldo, would it be possible to include the postman set in the github repo so anyone interested could take a look? I haven’t messed around with Postman to know if this is possible.
Hi @Justin_Young & @qwackers,
sorry for the delay. Had a hard time at work. I dont like to publish the postman collections publicly but I’d love to share in private with you both if you are still interested?