Open benjaminfrombe opened 4 years ago
It fails in get_device and I'm thinking this is access right issue. The response code is not 200 but something else, but the error report fails since the body isn't JSON.
I will fix the error report, but the reason behind your issue is still unknown.
Are you able to access the device in the app with the same user and password?
I just downloaded and tried this module and after some initial troubles I got it to work. I can similarly use list and set but the get command comes up with a different error:
matth@Ubuntu:~$ sudo python3 .local/bin/pcomfortcloud 'email@inter.net' 'password' get 1
reading from device 'Study' (8b9ba922de8289714a5b9d9a12377c04)
Traceback (most recent call last):
File ".local/bin/pcomfortcloud", line 11, in <module>
load_entry_point('pcomfortcloud==0.0.15', 'console_scripts', 'pcomfortcloud')()
File "/home/matth/.local/lib/python3.6/site-packages/pcomfortcloud/__main__.py", line 218, in main
print_result( session.get_device(device['id']) )
File "/home/matth/.local/lib/python3.6/site-packages/pcomfortcloud/session.py", line 285, in get_device
'parameters': self._read_parameters(_json['parameters'])
File "/home/matth/.local/lib/python3.6/site-packages/pcomfortcloud/session.py", line 436, in _read_parameters
value['nanoe'] = constants.NanoeMode(parameters['nanoe'])
File "/usr/lib/python3.6/enum.py", line 293, in __call__
return cls.__new__(cls, value)
File "/usr/lib/python3.6/enum.py", line 535, in __new__
return cls._missing_(value)
File "/usr/lib/python3.6/enum.py", line 548, in _missing_
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 4 is not a valid NanoeMode
Is this related or is it a different error?
@MatthK different issue, looks like you have a NanoeMode 4
we haven't seen before. What model do you have?
You may edit constants.py
and replace the last block with
class NanoeMode(Enum):
Unavailable = 0
Off = 1
On = 2
Unknown = 3
Unknown2 = 4
It's a Panasonic CS-E12VKA.
And wow, that did the trick.
reading from device 'Study' (8b9bf922de8289614a5b9d9a12377c04)
id : 8b9bf922de8289614a5b9d9a12377c04
parameters
temperatureInside : 25
temperatureOutside : 30
temperature : 28.0
power : On
mode : Cool
fanSpeed : Auto
airSwingHorizontal : Auto
airSwingVertical : Auto
eco : Auto
nanoe : Unknown2
Is there somewhere an API description on how to access the comfort cloud? I came across this module when I searched for an API as I ideally would like to integrate it into my custom made "homepage". I want to create a page with some Javascript to get and send the JSON. Alternatively I can try to trigger this module, but I am thinking it might be easier and more elegant if I could send the commands directly, hence the understanding of the API. Since I don't know Python, it might take a bit to understand how your module works.
May you open the Comfort Cloud
app and see what mode you have for nanoe
or eco
? Normally it's just a toggle but I'm starting to think that your model is reporting a combo value. If it's not activated you can do that under "Device list" (hamburger menu).
The module is simple enough and is just using http-requests, take a look at https://github.com/lostfields/python-panasonic-comfort-cloud/blob/master/requests.http using VSCode with extension humao.rest-client
The nanoe as well as the ECONAVI was disabled. I have enabled both now and ran the get again. But the nanoe still shows "Unkown2".
And thanks for the link. That looks quite promising.
Hmm, the product page says something about Nanoe-X and Nanoe-G, can you toggle them with the remote? and dump the value to see if it changes?
1: Off 2: Nanoe-X 3: Nanoe-G or Nanoe-G/Nanoe-X 4: Nanoe-G or Nanoe-G/Nanoe-X
When I turn it off, it shows as Off. When I turn it on, it shows as Unknown2. I don't have any other option.
I can use the list and set commands, but I can't use the get command, Any idea what could be wrong ?
./pcomfortcloud.py user@na.me $password$ get 1 reading from device 'Bedroom' (c06e5ccb6886fa8eb0e8a18b432402f0f35ee847d6315fe9dd92d4bbaef9d0dd) Traceback (most recent call last): File "./pcomfortcloud.py", line 5, in
main.main()
File "/html/panasonic/pcomfortcloud/main.py", line 218, in main
print_result( session.get_device(device['id']) )
File "/html/panasonic/pcomfortcloud/session.py", line 268, in get_device
raise ResponseError(response.status_code, response.text)
File "/html/panasonic/pcomfortcloud/session.py", line 43, in init
self.text = json.loads(text)
File "/usr/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)