999LV / SmartVirtualThermostat

Smart Virtual Thermostat python plugin for Domoticz home automation system
MIT License
41 stars 31 forks source link

https / SSL support ? #61

Open vntbrd opened 1 year ago

vntbrd commented 1 year ago

Hello,

Possible to support https? Domoticz can only be configured in https. (Self-signed or not). In this case, SmartVirtualThermostat cannot work.

For my part I modified plugin.py to add

import ssl

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

And I modified line 660 (https) :

url = "https://{}:{}/json.htm?{}".format(Parameters["Address"], Parameters["Port"], parse.quote(APICall, safe="&="))

And line 670 (context=ctx) :

response = request.urlopen(req, context=ctx)

I am aware that the modification is not clean (I am not a dev). But it works for my use case. This is a good lead for people who have the same problem as me.

Best regards,