Fixed conflicts
This commit is contained in:
@@ -17,6 +17,9 @@ async def async_setup(hass: HomeAssistant, config: dict):
|
|||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up LocalTuya integration from a config entry."""
|
"""Set up LocalTuya integration from a config entry."""
|
||||||
|
|
||||||
|
print('async_setup_entry localtuya subswitch [{}] '.format(entry.data))
|
||||||
|
|
||||||
for component in PLATFORMS:
|
for component in PLATFORMS:
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.config_entries.async_forward_entry_setup(entry, component)
|
hass.config_entries.async_forward_entry_setup(entry, component)
|
||||||
|
@@ -180,8 +180,9 @@ class LocaltuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
else:
|
else:
|
||||||
self.entities.append(_convert_entity(user_input))
|
self.entities.append(_convert_entity(user_input))
|
||||||
|
|
||||||
|
print('ENTITIES: [{}] '.format(self.entities))
|
||||||
config = {
|
config = {
|
||||||
CONF_NAME: f"{user_input[CONF_DEVICE_ID]} (import from configuration.yaml)",
|
CONF_NAME: f"{user_input[CONF_FRIENDLY_NAME]} (YAML)",
|
||||||
CONF_HOST: user_input[CONF_HOST],
|
CONF_HOST: user_input[CONF_HOST],
|
||||||
CONF_DEVICE_ID: user_input[CONF_DEVICE_ID],
|
CONF_DEVICE_ID: user_input[CONF_DEVICE_ID],
|
||||||
CONF_LOCAL_KEY: user_input[CONF_LOCAL_KEY],
|
CONF_LOCAL_KEY: user_input[CONF_LOCAL_KEY],
|
||||||
|
@@ -103,6 +103,10 @@ DPS_FIELDS = [
|
|||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Setup a Tuya switch based on a config entry."""
|
"""Setup a Tuya switch based on a config entry."""
|
||||||
|
|
||||||
|
print('config_entry: [{}] '.format(config_entry.data))
|
||||||
|
|
||||||
|
|
||||||
switches_to_setup = [
|
switches_to_setup = [
|
||||||
entity
|
entity
|
||||||
for entity in config_entry.data[CONF_ENTITIES]
|
for entity in config_entry.data[CONF_ENTITIES]
|
||||||
@@ -120,9 +124,11 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
pytuyadevice.set_version(float(config_entry.data[CONF_PROTOCOL_VERSION]))
|
pytuyadevice.set_version(float(config_entry.data[CONF_PROTOCOL_VERSION]))
|
||||||
pytuyadevice.set_dpsUsed({})
|
pytuyadevice.set_dpsUsed({})
|
||||||
|
|
||||||
|
print('switches_to_setup: [{}] '.format(switches_to_setup))
|
||||||
|
|
||||||
for device_config in switches_to_setup:
|
for device_config in switches_to_setup:
|
||||||
switches.append(
|
switches.append(
|
||||||
TuyaDevice(
|
LocaltuyaSwitch(
|
||||||
TuyaCache(pytuyadevice),
|
TuyaCache(pytuyadevice),
|
||||||
device_config[CONF_FRIENDLY_NAME],
|
device_config[CONF_FRIENDLY_NAME],
|
||||||
device_config[CONF_ID],
|
device_config[CONF_ID],
|
||||||
@@ -213,6 +219,7 @@ class TuyaCache:
|
|||||||
finally:
|
finally:
|
||||||
self._lock.release()
|
self._lock.release()
|
||||||
|
|
||||||
|
|
||||||
class LocaltuyaSwitch(SwitchEntity):
|
class LocaltuyaSwitch(SwitchEntity):
|
||||||
"""Representation of a Tuya switch."""
|
"""Representation of a Tuya switch."""
|
||||||
|
|
||||||
@@ -241,6 +248,20 @@ class LocaltuyaSwitch(SwitchEntity):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
print("ZIO KEN DEVINFO [{}]".format(self._device) )
|
||||||
|
return {
|
||||||
|
"identifiers": {
|
||||||
|
# Serial numbers are unique identifiers within a specific domain
|
||||||
|
("LocalTuya", self.unique_id)
|
||||||
|
},
|
||||||
|
"name": "MyName",
|
||||||
|
"manufacturer": "Tuya generic",
|
||||||
|
"model": "SmartSwitch",
|
||||||
|
"sw_version": "3.3",
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Get name of Tuya switch."""
|
"""Get name of Tuya switch."""
|
||||||
|
Reference in New Issue
Block a user