MadPatrick / somfy

Tahoma/Conexoon plugin for IO blinds, this plugin require internet connexion and a Somfy account
GNU General Public License v3.0
14 stars 3 forks source link

Newroller branch #17

Closed ab10002 closed 1 year ago

ab10002 commented 1 year ago

Tested:

2022-09-16 08:02:56.120 Error: Tahoma: Call to function 'onCommand' failed, exception details:
2022-09-16 08:02:56.121 Error: Tahoma: Traceback (most recent call last):
2022-09-16 08:02:56.121 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 458, in onCommand
2022-09-16 08:02:56.121 Error: Tahoma: _plugin.onCommand(DeviceId, Unit, Command, Level, Color)
2022-09-16 08:02:56.121 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 195, in onCommand
2022-09-16 08:02:56.121 Error: Tahoma: self.update_devices_status(event_list)
2022-09-16 08:02:56.121 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 351, in update_devices_status
2022-09-16 08:02:56.121 Error: Tahoma: Devices[dev].Units[Unit].LastLevel = int(level)
2022-09-16 08:02:56.121 Error: Tahoma: NameError: name 'Unit' is not defined
2022-09-16 08:03:19.107 Error: Tahoma: Call to function 'onHeartbeat' failed, exception details:
2022-09-16 08:03:19.107 Error: Tahoma: Traceback (most recent call last):
2022-09-16 08:03:19.107 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 466, in onHeartbeat
2022-09-16 08:03:19.107 Error: Tahoma: _plugin.onHeartbeat()
2022-09-16 08:03:19.107 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 271, in onHeartbeat
2022-09-16 08:03:19.107 Error: Tahoma: self.update_devices_status(event_list)
2022-09-16 08:03:19.107 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 341, in update_devices_status
2022-09-16 08:03:19.107 Error: Tahoma: Devices[dev].Units[Unit].LastLevel = 0
2022-09-16 08:03:19.107 Error: Tahoma: NameError: name 'Unit' is not defined
2022-09-16 08:04:19.126 Error: Tahoma: Call to function 'onHeartbeat' failed, exception details:
2022-09-16 08:04:19.126 Error: Tahoma: Traceback (most recent call last):
2022-09-16 08:04:19.126 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 466, in onHeartbeat
2022-09-16 08:04:19.126 Error: Tahoma: _plugin.onHeartbeat()
2022-09-16 08:04:19.126 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 271, in onHeartbeat
2022-09-16 08:04:19.126 Error: Tahoma: self.update_devices_status(event_list)
2022-09-16 08:04:19.126 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 363, in update_devices_status
2022-09-16 08:04:19.126 Error: Tahoma: Devices[dev].Units[1].nValue(3)
2022-09-16 08:04:19.126 Error: Tahoma: TypeError: 'int' object is not callable
MadPatrick commented 1 year ago

Did you removed the devices before using this branch?

ab10002 commented 1 year ago

Did you removed the devices before using this branch?

Sure

JanJaapKo commented 1 year ago

sorry, too rapid in copy paste, my mistake. Can you try again? All 3 errors should be fixed

ab10002 commented 1 year ago

sorry, too rapid in copy paste, my mistake. Can you try again? All 3 errors should be fixed 🤣 okay the log:

2022-09-16 14:38:23.234 Error: Tahoma: Call to function 'onCommand' failed, exception details:
2022-09-16 14:38:23.236 Error: Tahoma: Traceback (most recent call last):
2022-09-16 14:38:23.236 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 458, in onCommand
2022-09-16 14:38:23.236 Error: Tahoma: _plugin.onCommand(DeviceId, Unit, Command, Level, Color)
2022-09-16 14:38:23.236 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/plugin.py", line 189, in onCommand
2022-09-16 14:38:23.236 Error: Tahoma: event_list = self.tahoma.tahoma_command(self.json_data)
2022-09-16 14:38:23.236 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/tahoma.py", line 104, in tahoma_command
2022-09-16 14:38:23.236 Error: Tahoma: event_list = self.get_events()
2022-09-16 14:38:23.236 Error: Tahoma: File "/home/pi/domoticz/plugins/somfy-AddNewRollerShutter/tahoma.py", line 236, in get_events
2022-09-16 14:38:23.236 Error: Tahoma: logging.debug("get events response: status '" + str(response.status_code) + "' response body: '"+str(response.json())+"'")
2022-09-16 14:38:23.236 Error: Tahoma: File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
2022-09-16 14:38:23.236 Error: Tahoma: return complexjson.loads(self.text, **kwargs)
2022-09-16 14:38:23.236 Error: Tahoma: File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
2022-09-16 14:38:23.236 Error: Tahoma: return _default_decoder.decode(s)
2022-09-16 14:38:23.236 Error: Tahoma: File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
2022-09-16 14:38:23.236 Error: Tahoma: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2022-09-16 14:38:23.236 Error: Tahoma: File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
2022-09-16 14:38:23.236 Error: Tahoma: raise JSONDecodeError("Expecting value", s, err.value) from None
2022-09-16 14:38:23.236 Error: Tahoma: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
ab10002 commented 1 year ago

Read this in plugin.py... if lumstatus_l: #assuming for now that the luminance sensor is always a single unit in a device

I have allready 2 sensors...

JanJaapKo commented 1 year ago

Well at least this is a new error, so the previous 3 are indeed gone....... This error is a bit more tricky since the response data from the Somfy web api is different than expected, resulting in this json decoding error. I've left out the decoding now since it was only logging. Can you give it a try?

With the remark I mean the following: Somfy makes devies. Some of those have 2 (or more?) 'things' you can do with them: the blinds have both an up/down as well as an open/close movement. Here, you need then 2 units for 1 device. I am presuming, that this is not the case for this sensor (would be nice if you can provide a link to a website that shows it). It is probably 2x a device with 1 function (detect luminance).

Btw a short note on what you did that caused the error is usually also helpful (like: I tried to open my roller shutters).

ab10002 commented 1 year ago

Tested and NO errors! New devices are created and everything perfect👍

I'v 2 pieces from these: https://www.gossoutdoor.co.uk/somfy-sensors/sunis-wirefree-ii-io