Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should this work? #516

Open
kpmkpm opened this issue Jul 2, 2021 · 1 comment
Open

How should this work? #516

kpmkpm opened this issue Jul 2, 2021 · 1 comment

Comments

@kpmkpm
Copy link

kpmkpm commented Jul 2, 2021

Thank you for the awesome integration.

I am a bit buzzed though. I have installed this manually and can add devices and entities with HA UI. In instructions there seems to be a way to also write device and entity information in the configuration.yaml. I think this means the HA configuration.yaml located (in my case) in /home/homessistant/.homeassistant? However, while adding devices with UI, no lines are added to configuration.yaml, and I am wondering there are they stored?

It seems that (local) access to the devices seems to drop if I am also using the Tuya smartlife app with my mobile at the same time. It even seems to do this occasionally even if I use different user which has the devices shared? Or should I somehow block the devices to access internet and they should only be either using localtuya integration or "offical" tuya intergration not the both at the same time.

@JasperS2307
Copy link

@kpmkpm

If i'm correct, the configuration of the devices you add is saved (in key=> value format) as following:

First, there is the configuration of each entry which is stored in /home/homessistant/.homeassistant/.storage/core.config_entries (if you keep the original structure), this contains information about the DPS points, IP, keys, name, ID, source and what entities u selected to create, basicly, everything u saw and/or set when adding the devices.

Example entry:

{
    "entry_id": "1234567890abcdef",
    "version": 1,
    "domain": "localtuya",
    "title": "ayuTPlug office",
    "data": {
        "friendly_name": "ayuTPlug office",
        "host": "10.14.11.241",
        "local_key": "1234567890abcdef",
        "protocol_version": "3.3",
        "entities": [
            {
                "friendly_name": "ayuTPlug office",
                "current": 18,
                "current_consumption": 19,
                "voltage": 20,
                "id": 1,
                "platform": "switch"
            }
        ],
        "device_id": "1234567890abcdef",
        "dps_strings": [
            "1 (value: True)",
            "9 (value: 0)",
            ...
        ],
        "product_key": "1234567890abcdef"
    },
    "options": {},
    "pref_disable_new_entities": false,
    "pref_disable_polling": false,
    "source": "user",
    "unique_id": "1234567890abcdef",
    "disabled_by": null
}

Second, there is core.device_registry, information about "model", "manufacturer", name, ID, area, disabled (if u did) is stored here.

{
    "config_entries": [
        "{entry_id}"
    ],
    "connections": [],
    "identifiers": [
        [
            "localtuya",
            "local_{unique_id}"
        ]
    ],
    "manufacturer": "Unknown",
    "model": "1234567890abcdef",
    "name": "ayuTPlug office",
    "sw_version": "3.3",
    "entry_type": null,
    "id": "1234567890abcdef",
    "via_device_id": null,
    "area_id": "office",
    "name_by_user": null,
    "disabled_by": null
},

Third, there is core.entity_registry, containing, maybe u guessed it when reading the name, information about the entities.

{
    "entity_id": "switch.ayutplug_office",
    "config_entry_id": "{entry_id}",
    "device_id": "{device.id}",
    "area_id": null,
    "unique_id": "local_{}",
    "platform": "localtuya",
    "name": null,
    "icon": null,
    "disabled_by": null,
    "capabilities": {},
    "supported_features": 0,
    "device_class": null,
    "unit_of_measurement": null,
    "original_name": "ayuTPlug office",
    "original_icon": null
}

About the second question, I believe its a known "issue", maybe #87 can be interesting to read as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants