Page 1 of 1

Fujitsu Airco - Python plugin

Posted: Sunday 30 May 2021 11:00
by najtram
I'm having troubles understanding controlling airco of Fujitsu with domoticz. This could be controllable with this python library... → https://github.com/Mmodarre/pyfujitsu
⮑ Googling learnt me that there is an existing/working integration for HA. (So Domoticz should also be able to...)

I'm capable of installing other python examples. Eg, my blinds can be controlled with the following command:
script:///home/pi/domoticz/scripts/python/rolgordijn.py -t MACADRESSS -c move_target -a 95

Can someone help me out understanding the github code for pyfujitsu for such a command?

Thanks in advance!

Re: Fujitsu Airco - Python plugin

Posted: Tuesday 06 July 2021 22:01
by 593304
Please check my plugin based on pyfujitsu, I've just finished it: https://github.com/593304/Domoticz-Fujitsu-AC
You will find the usage of Mmodarre library in it, but in short:

Code: Select all

from pyfujitseu import splitAC
api = splitAC.api(<email>, <password>, <region [eu, cn, other]>)
dsn = api.get_devices_dsn()[0]
ac = splitAC.splitAC(dsn, api)
ac.<property or function name>
Property and function names:

Code: Select all

ac.adjust_temperature
ac.changeOperationMode(...)
ac.economy_mode_on(...)
ac.get_fan_speed_desc(...)
ac.operation_mode_desc
ac.turnOn(...)
ac.adjust_temperature_degree
ac.changeSwingMode(...)
ac.fan_speed
ac.get_swing_mode_desc(...)
ac.outdoor_low_noise
ac.vertical_direction(...)
ac.af_horizontal_direction
ac.changeTemperature(...)
ac.fan_speed_auto(...)
ac.horizontal_direction(...)
ac.powerful_mode
ac.vertical_swing_off(...)
ac.af_horizontal_swing
ac.device_name
ac.fan_speed_high(...)
ac.horizontal_swing_off(...)
ac.powerfull_mode_off(...)
ac.vertical_swing_on(...)
ac.af_vertical_direction
ac.dsn
ac.fan_speed_low(...)
ac.horizontal_swing_on(...)
ac.powerfull_mode_on(...)
ac.af_vertical_swing
ac.economy_mode
ac.fan_speed_medium(...)
ac.min_heat
ac.refresh_properties(...)
ac.changeFanSpeed(...)
ac.economy_mode_off(...)
ac.fan_speed_quiet(...)
ac.operation_mode
ac.turnOff(...)
Adam

Re: Fujitsu Airco - Python plugin

Posted: Wednesday 07 July 2021 11:14
by waltervl
593304 wrote: Tuesday 06 July 2021 22:01 Please check my plugin based on pyfujitsu, I've just finished it: https://github.com/593304/Domoticz-Fujitsu-AC
Adam
Thank you, I added it to the Plugins list on wiki https://www.domoticz.com/wiki/Plugins

Re: Fujitsu Airco - Python plugin

Posted: Monday 24 January 2022 20:29
by Mirkoser
I'm getting an error code...Any idea what is going wrong? Phyton 3.8.10 is running


022-01-24 20:27:05.379 Error: Klimaanlage Garage: (FujitsuACPlugin) failed to load 'plugin.py', Python Path used was '/home/mirko/domoticz/plugins/Domoticz-Fujitsu-AC/:/usr/lib/python38.zip:/usr/lib/python3.8:/usr/lib/python3.8/lib-dynload:/usr/local/lib/python3.8/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.8/dist-packages'.
2022-01-24 20:27:05.379 Error: Klimaanlage Garage: (Klimaanlage Garage) Module Import failed, exception: 'ModuleNotFoundError'
2022-01-24 20:27:05.379 Error: Klimaanlage Garage: (Klimaanlage Garage) Module Import failed: ' Name: pyfujitseu'
2022-01-24 20:27:05.379 Error: Klimaanlage Garage: (Klimaanlage Garage) Error Line details not available.

Re: Fujitsu Airco - Python plugin

Posted: Monday 16 May 2022 23:57
by THBR
Having the same problems


2022-05-16 23:54:37.167 Error: Airco beneden: (FujitsuACPlugin) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-Fujitsu-AC/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2022-05-16 23:54:37.167 Error: Airco beneden: Module Import failed, exception: 'ModuleNotFoundError'
2022-05-16 23:54:37.168 Error: Airco beneden: Module Import failed: ' Name: pyfujitseu'
2022-05-16 23:54:37.168 Error: Airco beneden: Error Line details not available.
2022-05-16 23:54:37.168 Error: Airco beneden: Exception traceback:
2022-05-16 23:54:37.168 Error: Airco beneden: ----> Line 48 in '/home/pi/domoticz/plugins/Domoticz-Fujitsu-AC/plugin.py', function <module>

Re: Fujitsu Airco - Python plugin

Posted: Tuesday 17 May 2022 0:08
by waltervl
Try to install the failing module with elevated rights eg:

sudo pip3 install pyfujitsu

Re: Fujitsu Airco - Python plugin (SOLVED)

Posted: Thursday 19 May 2022 13:01
by THBR
Yes, that worked (and set Refresh interval plugin to 10).

Thanks !

Gr. Theo.

Re: Fujitsu Airco - Python plugin

Posted: Tuesday 17 October 2023 10:48
by rensbr
I'm trying to use this plugin inside docker. I have installled the pyfujitsu trough the docker with:

Code: Select all

docker exec -it domoticz /bin/bash
pip3 install wheel
pip3 install pyfujitsu
I'm getting the following:

Code: Select all

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.3.1; however, version 23.3 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
And in the logger i have the following errors:

Code: Select all

2023-10-17 10:47:08.164 Error: Airco zolder : 'onHeartbeat' failed 'HTTPError':'400 Client Error: Bad Request for url: https://user-field-eu.aylanetworks.com/users/sign_in.json'.
2023-10-17 10:47:08.164 Error: Airco zolder : Exception traceback:
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 747 in '/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py', function onHeartbeat
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 704 in '/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py', function onHeartbeat
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 104 in '/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py', function beatHeartbeat
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 709 in '/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py', function update
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 164 in '/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py', function updateAcs
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 59 in '/usr/local/lib/python3.7/dist-packages/pyfujitseu/api.py', function get_devices_dsn
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 54 in '/usr/local/lib/python3.7/dist-packages/pyfujitseu/api.py', function _get_devices
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 108 in '/usr/local/lib/python3.7/dist-packages/pyfujitseu/api.py', function _authenticate
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 164 in '/usr/local/lib/python3.7/dist-packages/pyfujitseu/api.py', function _call_api
2023-10-17 10:47:08.164 Error: Airco zolder : ----> Line 960 in '/usr/local/lib/python3.7/dist-packages/requests/models.py', function raise_for_status
Any thoughts?

Edit: I have used a password of 20 characters and that is too long for the plugin. I switched this to 10 characters and now it works!

Also I have added the below lines to my dockerfile and now it also survives a reboot:

Code: Select all

pip3 install wheel
pip3 install pyfujitsu

Re: Fujitsu Airco - Python plugin

Posted: Thursday 02 November 2023 7:53
by rensbr
Does anyone recognize this? When I enable the plugin the whole responsiveness of Domoticz runs backwards. All the lights in my house that should respond to movement or sensors are not turned on anymore or very very very late.

Also the responsiveness of the plugin is quite slow. It takes more than 30 seconds before a command in Domoticz turns the airco on.

So currently I'm not using the plugin at all, because the performance is quite bad.

Edit: This was solved by setting the refresh interval to the highest possible value.

Re: Fujitsu Airco - Python plugin

Posted: Thursday 23 November 2023 11:54
by rensbr
I have updated Domoticz to version 2023.2 and updated docker to version 24.0.7 and since I have done that I'm getting the following error when I tried to change modes:

Code: Select all

2023-11-23 11:50:04.392 Airco zolder : onCommand called for Unit: 3, Parameter: 'Set Level', Level: '40'
2023-11-23 11:50:04.343 Status: User: Rens (IP: 172.18.0.1) initiated a switch command (655/Airco zolder - Airco Zolder - Operation selector/Set Level)
2023-11-23 11:50:12.872 Airco zolder : Local context:
2023-11-23 11:50:12.872 Airco zolder : ----> 'DATABASE_KEY' 'FujitsuACPlugin'
2023-11-23 11:50:12.872 Airco zolder : ----> 'Devices' '{1: <Domoticz.Device object at 0x7f7e4e550530>, 2: <Domoticz.Device object at 0x7f7e4e5505d0>, 3: <Domoticz.Device object at 0x7f7e4e550670>, 4: <Domoticz.Device object at 0x7f7e4e550710>, 5: <Domoticz.Device object at 0x7f7e4e5507b0>, 6: <Domoticz.Device object at 0x7f7e4e550850>, 7: <Domoticz.Device object at 0x7f7e4e5508f0>, 8: <Domoticz.Device object at 0x7f7e4e550990>}'
2023-11-23 11:50:12.872 Airco zolder : ----> 'Domoticz' '<module 'Domoticz' (built-in)>'
2023-11-23 11:50:12.873 Airco zolder : ----> 'Images' '{}'
2023-11-23 11:50:12.873 Airco zolder : ----> 'Parameters' '{'HardwareID': 44, 'HomeFolder': '/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/', 'StartupFolder': '/opt/domoticz/', 'UserDataFolder': '/opt/domoticz/userdata/', 'WebRoot': '', 'Database': '/opt/domoticz/userdata/domoticz.db', 'Language': 'nl', 'Version': '0.3', 'Author': '593304', 'Name': 'Airco zolder ', 'Address': '', 'Port': '0', 'SerialPort': '', 'Username': '', 'Password': '', 'Key': 'FujitsuACPlugin', 'Mode1': '', 'Mode2': 'eu', 'Mode3': '150', 'Mode4': 'on', 'Mode5': '', 'Mode6': '', 'DomoticzVersion': '2023.2 (build 15664)', 'DomoticzHash': 'd0a0d075e', 'DomoticzBuildTime': '2023-11-22 08:23:35'}'
2023-11-23 11:50:12.873 Airco zolder : ----> 'Settings' '{'DB_Version': '165', 'Title': 'XXX', 'LightHistoryDays': '30', 'MeterDividerEnergy': '1000', 'MeterDividerGas': '100', 'MeterDividerWater': '100', 'RandomTimerFrame': '15', 'ElectricVoltage': '230', 'CM113DisplayType': '1', '5MinuteHistoryDays': '7', 'SensorTimeout': '61', 'SensorTimeoutNotification': '0', 'UseAutoUpdate': '1', 'UseAutoBackup': '1', 'CostEnergy': '2149', 'CostEnergyT2': '2149', 'CostEnergyR1': '800', 'CostEnergyR2': '800', 'CostGas': '6218', 'CostWater': '16473', 'UseEmailInNotifications': '1', 'SendErrorNotifications': '0', 'EmailPort': '25', 'EmailAsAttachment': '0', 'DoorbellCommand': '0', 'SmartMeterType': '0', 'NotificationSensorInterval': '43200', 'NotificationSwitchInterval': '0', 'RemoteSharedPort': '6144', 'Language': 'nl', 'DashboardType': '0', 'MobileType': '1', 'WindUnit': '0', 'TempUnit': '0', 'WeightUnit': '0', 'SecStatus': '0', 'SecOnDelay': '30', 'ReleaseChannel': '0', 'RaspCamParams': '-w 800 -h 600 -t 1', 'UVCParams': '-S80 -B128 -C128 -G80 -x800 -y600 -q100', 'AcceptNewHardware': '1', 'ZWavePollInterval': '60', 'ZWaveEnableDebug': '0', 'ZWaveNetworkKey': '0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10', 'ZWaveEnableNightlyNetworkHeal': '0', 'BatteryLowNotification': '10', 'AllowWidgetOrdering': '1', 'ActiveTimerPlan': '0', 'HideDisabledHardwareSensors': '1', 'EnableEventScriptSystem': '1', 'DisableDzVentsSystem': '0', 'DzVentsLogLevel': '3', 'LogEventScriptTrigger': '1', 'WebTheme': 'machinon', 'FloorplanPopupDelay': '750', 'FloorplanFullscreenMode': '0', 'FloorplanAnimateZoom': '1', 'FloorplanShowSensorValues': '1', 'FloorplanShowSwitchValues': '0', 'FloorplanShowSceneNames': '0', 'FloorplanRoomColour': 'Blue', 'FloorplanActiveOpacity': '25', 'FloorplanInactiveOpacity': '5', 'TempHome': '20', 'TempAway': '15', 'TempComfort': '22.0', 'DegreeDaysBaseTemperature': '18.0', 'HTTPURL': 'aHR0cHM6Ly93d3cuc29tZWdhdGV3YXkuY29tL3B1c2h1cmwucGhwP3VzZXJuYW1lPSNGSUVMRDEmcGFzc3dvcmQ9I0ZJRUxEMiZhcGlrZXk9I0ZJRUxEMyZmcm9tPSNGSUVMRDQmdG89I1RPJm1lc3NhZ2U9I01FU1NBR0U=', 'HTTPPostContentType': 'YXBwbGljYXRpb24vanNvbg==', 'ShowUpdateEffect': '0', 'ShortLogInterval': '5', 'SendErrorsAsNotification': '0', 'IFTTTEnabled': '0', 'EmailEnabled': '0', 'Location': '51.51979;5.50513', 'ClickatellEnabled': '0', 'ClickatellAPI': '0', 'ClickatellFrom': '0', 'ClickatellPassword': '0', 'ClickatellTo': '0', 'ClickatellUser': '0', 'EmailFrom': '0', 'EmailServer': '0', 'EmailTo': '0', 'EmailPassword': '0', 'EmailUsername': '0', 'GCMEnabled': '0', 'HTTPEnabled': '0', 'HTTPField1': '0', 'HTTPField2': '0', 'HTTPField3': '0', 'HTTPField4': '0', 'HTTPPostData': '0', 'HTTPPostHeaders': '0', 'HTTPTo': '0', 'KodiIPAddress': '192.168.0.194', 'KodiEnabled': '0', 'KodiPort': '9777', 'KodiTimeToLive': '5', 'LmsPlayerMac': '0', 'LmsDuration': '5', 'LmsEnabled': '0', 'ProwlAPI': '0', 'ProwlEnabled': '0', 'PushALotAPI': '0', 'PushALotEnabled': '0', 'PushbulletAPI': '0', 'PushbulletEnabled': '0', 'PushoverAPI': '0', 'PushoverUser': '0', 'PushoverEnabled': '0', 'PushsaferAPI': '0', 'PushsaferImage': '0', 'PushsaferEnabled': '0', 'TelegramAPI': '749223504:AAHs1vSDI2u6t_kYdLkGFGYm4WQDoNV-DIQ', 'TelegramChat': '816312166', 'TelegramEnabled': '1', 'WebLocalNetworks': '127.0.0.1;192.168.0.188;192.168.0.184;localhost;192.168.0.201;192.168.0.200', 'SecPassword': '', 'ProtectionPassword': '', 'MyDomoticzUserId': '', 'MyDomoticzSubsystems': '0', 'OneWireSensorPollPeriod': '0', 'OneWireSwitchPollPeriod': '0', 'IFTTTAPI': '0', 'MyDomoticzPassword': 'IzNCODhoalF0a0ZSMkI2JmxaWUo=', 'MyDomoticzInstanceId': 'D0F3B744C471464', 'EventSystemLogFullURL': '1', 'InfluxActive': '0', 'InfluxIP': '192.168.0.200', 'InfluxPort': '8086', 'InfluxPath': '0', 'InfluxDatabase': 'Domoticz', 'InfluxUsername': 'Home', 'InfluxPassword': '==', 'InfluxDebug': '1', 'FCMEnabled': '0', 'MaxElectricPower': '6000', 'InfluxVersion2': '1', 'Unique_ID': '735922de-7d10-4707-920d-c930b7e11d29', 'ShortLogAddOnlyNewValues': '0', 'Domoticz_Version': '2023.2 (build 15664)', 'AllowPlainBasicAuth': '1'}'
2023-11-23 11:50:12.873 Airco zolder : ----> '_plugin' '<plugin.FujitsuACPlugin object at 0x7f7e8040c550>'
2023-11-23 11:50:12.873 Airco zolder : ----> 'json' '<module 'json' from '/usr/lib/python3.9/json/__init__.py'>'
2023-11-23 11:50:12.873 Airco zolder : ----> 'splitAC' '<module 'pyfujitseu.splitAC' from '/usr/local/lib/python3.9/dist-packages/pyfujitseu/splitAC.py'>'
2023-11-23 11:50:12.873 Airco zolder : Acquiring GIL for 'onCommandCallback'
2023-11-23 11:50:12.871 Error: Airco zolder : Call to function 'onCommand' failed, exception details:
2023-11-23 11:50:12.872 Error: Airco zolder : Traceback (most recent call last):
2023-11-23 11:50:12.872 Error: Airco zolder : File "/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py", line 735, in onCommand
2023-11-23 11:50:12.872 Error: Airco zolder : _plugin.onCommand(Unit, Command, Level, Hue)
2023-11-23 11:50:12.872 Error: Airco zolder : File "/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py", line 691, in onCommand
2023-11-23 11:50:12.872 Error: Airco zolder : self.helper.runCommand(Unit, Command, Level)
2023-11-23 11:50:12.872 Error: Airco zolder : File "/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py", line 427, in runCommand
2023-11-23 11:50:12.872 Error: Airco zolder : updateValues = self.units[unit]["command"](unit, dsn, command, str(level))
2023-11-23 11:50:12.872 Error: Airco zolder : File "/opt/domoticz/userdata/plugins/Domoticz-Fujitsu-AC/plugin.py", line 477, in operationSelectorSwitch
2023-11-23 11:50:12.872 Error: Airco zolder : ac.changeOperationMode(sValue)
2023-11-23 11:50:12.872 Error: Airco zolder : File "/usr/local/lib/python3.9/dist-packages/pyfujitseu/splitAC.py", line 196, in changeOperationMode
2023-11-23 11:50:12.872 Error: Airco zolder : operationMode = self._operation_mode_translate(operationMode)
2023-11-23 11:50:12.872 Error: Airco zolder : File "/usr/local/lib/python3.9/dist-packages/pyfujitseu/splitAC.py", line 384, in _operation_mode_translate
2023-11-23 11:50:12.872 Error: Airco zolder : return DICT_OPERATION_MODE[operation_mode]
2023-11-23 11:50:12.872 Error: Airco zolder : KeyError: 'Dry'
Does anybody have any idea what happens?

As said I'm running everything inside docker and my dockerfile looks like:

Code: Select all

FROM domoticz/domoticz

EXPOSE 8080
EXPOSE 8081
EXPOSE 444

WORKDIR /opt/domoticz

RUN pip install --upgrade pip
RUN pip3 install --upgrade pip

#FOR LG plugin
RUN pip install pylgtv
#FOR Presence detection
RUN pip install paramiko
RUN pip install parallel-ssh

#FOR conbee II plugin
RUN pip install requests
RUN pip3 install requests

#FOR airco
RUN pip3 install wheel
RUN pip3 install pyfujitsu

ENTRYPOINT ["docker-entrypoint.sh"]

CMD ["/opt/domoticz/domoticz"]

Re: Fujitsu Airco - Python plugin

Posted: Thursday 25 April 2024 9:40
by miniil
Hello

I'm having those errors on Windows :

Code: Select all

2024-04-25 09:30:34.004 Error: AC Fujitsu: Traceback (most recent call last):
2024-04-25 09:30:34.004 Error: AC Fujitsu: File "C:\Program Files (x86)\Domoticz\plugins\Domoticz-Fujitsu-AC-main\plugin.py", line 48, in <module>
2024-04-25 09:30:34.004 Error: AC Fujitsu: from pyfujitseu import splitAC
2024-04-25 09:30:34.004 Error: AC Fujitsu: File "C:\Users\mdene\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyfujitseu\splitAC.py", line 1, in <module>
2024-04-25 09:30:34.004 Error: AC Fujitsu: from .api import Api as api
2024-04-25 09:30:34.004 Error: AC Fujitsu: File "C:\Users\mdene\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyfujitseu\api.py", line 2, in <module>
2024-04-25 09:30:34.004 Error: AC Fujitsu: import requests
2024-04-25 09:30:34.004 Error: AC Fujitsu: File "C:\Users\mdene\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\requests\__init__.py", line 48, in <module>
2024-04-25 09:30:34.004 Error: AC Fujitsu: from charset_normalizer import __version__ as charset_normalizer_version
2024-04-25 09:30:34.004 Error: AC Fujitsu: File "C:\Users\mdene\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\charset_normalizer\__init__.py", line 24, in <module>
2024-04-25 09:30:34.004 Error: AC Fujitsu: from .api import from_bytes, from_fp, from_path, is_binary
2024-04-25 09:30:34.004 Error: AC Fujitsu: File "C:\Users\mdene\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\charset_normalizer\api.py", line 5, in <module>
2024-04-25 09:30:34.004 Error: AC Fujitsu: from .cd import (
2024-04-25 09:30:34.004 Error: AC Fujitsu: File "C:\Users\mdene\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\charset_normalizer\cd.py", line 14, in <module>
2024-04-25 09:30:34.004 Error: AC Fujitsu: from .md import is_suspiciously_successive_range
2024-04-25 09:30:34.004 Error: AC Fujitsu: SystemError: initialization of md__mypyc did not return an extension module
Could you please help me?