I tried it, and I got the following error:
2020-04-17 14:15:47 ERROR (MainThread) [homeassistant.components.switch] Error while setting up localtuya platform for switch,
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/localtuya/switch.py", line 76, in setup_platform,
config.get(CONF_VOLTAGE),
File "/config/custom_components/localtuya/switch.py", line 148, in __init__,
self._status = self._device.status(),
File "/config/custom_components/localtuya/switch.py", line 129, in status,
self._cached_status = self.__get_status(),
File "/config/custom_components/localtuya/switch.py", line 110, in __get_status,
status = self._device.status(),
File "/config/custom_components/localtuya/pytuya/__init__.py", line 311, in status,
result = json.loads(result),
File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads,
return _default_decoder.decode(s),
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode,
obj, end = self.raw_decode(s, idx=_w(s, 0).end()),
File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode,
raise JSONDecodeError("Expecting value", s, err.value) from None,
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0),
I have also changed the acs_voltage with value_tamplate, as the configuration was not valid when using acs_voltage (in the sensor configuration).