Mmodarre / pyfujitsu_for_homeassistant

MIT License
31 stars 33 forks source link

problem with platform climate.fujitsu_general_heatpump #14

Closed pilot1981 closed 4 years ago

pilot1981 commented 4 years ago

Hi, I'm trying to add this integration in my HASSIO v 0.103.4, I have these files:

/config/custom_components/fujitsu_general_heatpump/climate.py /config/custom_components/fujitsu_general_heatpump/manifest.json /config/custom_components/fujitsu_general_heatpump/init.py

and this in configuration.yaml:

climate:

but I receive this error:

Platform error climate.fujitsu_general_heatpump - Integration 'fujitsu_general_heatpump' not found.

I also have to install this https://github.com/Mmodarre/pyfujitsu? how I can do it?

chiefcomm commented 4 years ago

Mmodarre the original developer hasn't been making updates since this integration broke back since version 0.95 - I suggest reading https://community.home-assistant.io/t/add-support-for-fujitsu-wireless-air-conditioning-control-app-fglair/65999/101 where a few folk have kept this going to the best of their ability. Good luck.

meichthys commented 4 years ago

There is a pull request (#13) that says it fixes this issue although i couldn't seem to get it to work.

meichthys commented 4 years ago

@pilot1981 I've been able to get the integration to work, using the information in the link that @chiefcomm provided. The key is to make the changes to the api.py file regardless of what region you are in.

pilot1981 commented 4 years ago

Hi, I copied 3 files from here: https://github.com/xerxes87/pyfujitsu_for_homeassistant/tree/master/custom_components/fujitsu_general_heatpump in my custom components/fuji directory and then I create new file api.py as reported here: https://community.home-assistant.io/t/add-support-for-fujitsu-wireless-air-conditioning-control-app-fglair/65999/103

restarted HA but I obtain always same initial error...

I noticed file token.txt wasn't created automatically...I need to create it manually?

pilot1981 commented 4 years ago

I also modified api.py file as this with eu region:

class Api: def init(self,username,password,region='eu',tokenpath='token.txt'):

and according to it, now my configuration.yaml seems as this one below:

climate:

meichthys commented 4 years ago

@pilot1981 You could try the "US" region, that's what worked for me. Your yaml is the same as mine apart from the 'us' region.

pilot1981 commented 4 years ago

same result using region "us" in configuration.yaml and api.py files...

pilot1981 commented 4 years ago

strange behaviour platform not found....I don't understand...

meichthys commented 4 years ago

I could be wrong, but that sounds like it could be an issue with the manifest.

meichthys commented 4 years ago

@pilot1981 could you give me a directory structure of your setup? It could be that the files aren't located where home-assistant expects them to be.

pilot1981 commented 4 years ago

89D911C2-1166-4C26-99B0-A932D0E7DF8B

meichthys commented 4 years ago

@pilot1981, your directory is named wrong. Instead of: /config/custom_components/fujitsu_gen/ you should have: /config/custom_components/fujitsu_general_heatpump/

image

pilot1981 commented 4 years ago

it's my web interface abbreviation...

Schermata 2020-01-09 alle 08 31 04

name of directory seems ok...

meichthys commented 4 years ago

Ah ok, that looks good then.

Could you confirm the path of the api.py file?

pilot1981 commented 4 years ago
Schermata 2020-01-09 alle 16 15 17
meichthys commented 4 years ago

@pilot1981 The api.py file should not be in the custom_components/fujitsu_general_heatpump directory. Make sure the following directory structures exist: image The __pycache__ directories shouldn't be necessary, but all the other files are required.

meichthys commented 4 years ago

Also note, you won't see the deps directory when using the Configuratior add-on unless you remove the 'deps' directory from the ignore list in the Configurator add-on config settings.

meichthys commented 4 years ago

@pilot1981 Any luck?

pilot1981 commented 4 years ago

I don't found this directory in my HASSIO environment...you know correct path for HASSIO?

pilot1981 commented 4 years ago

@meichthys

pilot1981 commented 4 years ago

Hi, in HASSIO I manually created /config/custom_components/pyfujitsu/api.py and now I have this error:

Error while setting up platform fujitsu_general_heatpump Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, 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 68, in setup_platform import pyfujitsu.api as fgapi ModuleNotFoundError: No module named 'pyfujitsu'

So, I think I don't have properly installed pyfujitsu module in my HASSIO...

please can you explain howto install this library on my HASSIO?

I have to copy all files and directory of https://github.com/Mmodarre/pyfujitsu in my /config/custom_components/pyfujitsu ?

pilot1981 commented 4 years ago

Hi, I copied all files and directory of https://github.com/Mmodarre/pyfujitsu in my /config/custom_components/pyfujitsu

then I created a new file:

/config/custom_components/pyfujitsu/api.py

in same way reported here: https://community.home-assistant.io/t/add-support-for-fujitsu-wireless-air-conditioning-control-app-fglair/65999/103

but I have problem to load module pyfujitsu:

Error while setting up platform fujitsu_general_heatpump Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, 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 68, in setup_platform import pyfujitsu.api as fgapi ModuleNotFoundError: No module named 'pyfujitsu'

meichthys commented 4 years ago

@pilot1981 I think you still have your directory structure mixed up. Under the custom components directory you should not have the pyfujitsu directory, you should have fujitsu_gener_heatpump.

You need the following two directory paths: image If you can't find the deps directory it could be because you have installed homeassistant differently?

Could you share how you installed home-assistant?

meichthys commented 4 years ago

Also, if you don't see the 'deps' directory when using configurator, see my comment above: https://github.com/Mmodarre/pyfujitsu_for_homeassistant/issues/14#issuecomment-572684720

pilot1981 commented 4 years ago

@meichthys my /config/deps is empty... I think this is normal in HASSIO installation...you also have HASSIO?

meichthys commented 4 years ago

@pilot1981 Yes i have HASSIO, deps is supposed to be empty unless you are running a custom component that also requires a custom dependency (as does this custom component).

pilot1981 commented 4 years ago

@meichthys you are right! I created news directory in /config/deps and now I don't have error to load pyfuijtsu module: thanks!

meichthys commented 4 years ago

@pilot1981 Great news! Enjoy! There's still work that needs to be done on this integration, but it works reasonably well.

pilot1981 commented 4 years ago

I don’t see any switch/sensors...anyone can say me which name they have?

meichthys commented 4 years ago

If you want to add the heatpumps to your dashboard (lovelace), simply add a thermostat card and use the climate.

Note: The current integration doesn't show the room temperature as mentioned in #1 image

If you're looking for ways to automate, you'll want to use the climate services like: climate.set_temperature

image

pilot1981 commented 4 years ago

Found!

Lovelace don’t listed it as unused entity list...

vicfalls commented 4 years ago

Hi,

I try to integrate the fujitsu heatpump. I did how it is desrcibed in comment https://github.com/Mmodarre/pyfujitsu_for_homeassistant/issues/14#issuecomment-574274281

I'm using the latest HASS image https://www.home-assistant.io/hassio/installation/ for a Raspi4 I can see the AC in Lovelace, but there is no communication between HASS and AC. I get a bunch of errors in the log. Can anyone help me?

2020-04-13 22:43:45 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-04-13 22:43:51 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for fujitsu_general_heatpump which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-04-13 22:43:52 ERROR (MainThread) [homeassistant.components.climate] Error while setting up fujitsu_general_heatpump platform for climate Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 178, 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 120, in _authenticate fd = os.open(self._ACCESS_TOKEN_FILE, os.O_WRONLY | os.O_CREAT, 0o777) TypeError: open: path should be string, bytes or os.PathLike, not NoneType 2020-04-13 22:44:03 WARNING (MainThread) [homeassistant.setup] Setup of default_config is taking over 10 seconds. 2020-04-13 22:46:11 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2940654448] must contain at least one of temperature, target_temp_high, target_temp_low. Traceback (most recent call last): File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 272, in call return self._compiled([], data) File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 817, in validate_callable return schema(data) File “/usr/src/homeassistant/homeassistant/helpers/config_validation.py”, line 115, in validate raise vol.Invalid(“must contain at least one of {}.”.format(", ".join(keys))) voluptuous.error.Invalid: must contain at least one of temperature, target_temp_high, target_temp_low. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 134, in handle_call_service connection.context(msg), File “/usr/src/homeassistant/homeassistant/core.py”, line 1210, in async_call processed_data = handler.schema(service_data) File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 208, in call return self._exec((Schema(val) for val in self.validators), v) File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 287, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 283, in _exec v = func(v) File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 276, in call raise er.MultipleInvalid([e]) voluptuous.error.MultipleInvalid: must contain at least one of temperature, target_temp_high, target_temp_low. 2020-04-13 22:46:15 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2940654448] must contain at least one of temperature, target_temp_high, target_temp_low. Traceback (most recent call last): File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 272, in call return self._compiled([], data) File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 817, in validate_callable return schema(data) File “/usr/src/homeassistant/homeassistant/helpers/config_validation.py”, line 115, in validate raise vol.Invalid(“must contain at least one of {}.”.format(", ".join(keys))) voluptuous.error.Invalid: must contain at least one of temperature, target_temp_high, target_temp_low.

Thanks Vic

meichthys commented 4 years ago

@vicfalls I've also noticed that the communication between the fujitsu_general_heatpupmp integration and the actual heatpump can be hit or miss. For me the thermostat card in lovelace does seem to display the correct set temperature from the fglair app but trying to change the temperature from homeassistant is spotty. Sometimes it will take, but most of the time it wont.

This custom integration definitely needs a little work, but the potential is there. It will probably take someone to fork this project and move it forward.

@Mmodarre Would you be ok with someone forking and moving this forward, or would you recommend pull requests be submitted?

vicfalls commented 4 years ago

@meichthys Super, sounds good. I appreciate your commitment to help.

vicfalls commented 4 years ago

@vicfalls I've also noticed that the communication between the fujitsu_general_heatpupmp integration and the actual heatpump can be hit or miss. For me the thermostat card in lovelace does seem to display the correct set temperature from the fglair app but trying to change the temperature from homeassistant is spotty. Sometimes it will take, but most of the time it wont.

This custom integration definitely needs a little work, but the potential is there. It will probably take someone to fork this project and move it forward.

@Mmodarre Would you be ok with someone forking and moving this forward, or would you recommend pull requests be submitted?

@meichthys I made a hard shutdown of the HASS, unplug - waiting about 1 minute, and restart the system again. All error messages are gone and the HASS is communicating with the AC. It seems, that the system got hung somehow. It would be great if the repository can be implemented via HACS in future.

meichthys commented 4 years ago

Great to hear! I haven't tried the A/C side of things yet, but maybe that will work better than the heating temp adjustments. I'll find out in a few weeks when things start warming up by me 🔥