Hi, I have googled a lot but still can’t work this out …
I have a tuya device (switch) with information such as power consumption available but not exposed as sensors. I can see the info in the diagnostics (below).
How can I expose such information to use in graphs?
{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2022.12.8",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.10.7",
"docker": true,
"arch": "x86_64",
"timezone": "Europe/Dublin",
"os_name": "Linux",
"os_version": "5.15.80",
"supervisor": "2022.11.2",
"host_os": "Home Assistant OS 9.4",
"docker_version": "20.10.19",
"chassis": "vm",
"run_as_root": true
},
"custom_components": {
"tuya_v2": {
"version": "1.5.0",
"requirements": [
"tuya-iot-py-sdk==0.4.1"
]
},
"currentcost": {
"version": "0.2.3",
"requirements": [
"pyserial-asyncio==0.4",
"xmltodict==0.12.0"
]
},
"localtuya": {
"version": "4.1.1",
"requirements": []
},
"solis": {
"version": "3.2.0",
"requirements": []
},
"hacs": {
"version": "1.28.4",
"requirements": [
"aiogithubapi>=22.2.4"
]
}
},
"integration_manifest": {
"domain": "tuya",
"name": "Tuya",
"documentation": "https://www.home-assistant.io/integrations/tuya",
"requirements": [
"tuya-iot-py-sdk==0.6.6"
],
"dependencies": [
"ffmpeg"
],
"codeowners": [
"@Tuya",
"@zlinoliver",
"@frenck"
],
"config_flow": true,
"iot_class": "cloud_push",
"dhcp": [
{
"macaddress": "105A17*"
},
{
"macaddress": "10D561*"
},
{
"macaddress": "1869D8*"
},
{
"macaddress": "381F8D*"
},
{
"macaddress": "508A06*"
},
{
"macaddress": "68572D*"
},
{
"macaddress": "708976*"
},
{
"macaddress": "7CF666*"
},
{
"macaddress": "84E342*"
},
{
"macaddress": "D4A651*"
},
{
"macaddress": "D81F12*"
}
],
"integration_type": "hub",
"loggers": [
"tuya_iot"
],
"is_built_in": true
},
"data": {
"endpoint": "https://openapi.tuyaeu.com",
"auth_type": 0,
"country_code": "353",
"app_type": "tuyaSmart",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": false,
"name": "Log Cabin meter",
"model": "AT-Q-SY1-JWT",
"category": "dlq",
"product_id": "jdj6ccklup7btq3a",
"product_name": "WiFi Din Rail Switch with metering",
"online": true,
"sub": false,
"time_zone": "+00:00",
"active_time": "2022-12-10T15:32:54+00:00",
"create_time": "2022-12-10T15:32:54+00:00",
"update_time": "2022-12-10T17:12:35+00:00",
"function": {
"switch": {
"type": "Boolean",
"value": {}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
},
"relay_status": {
"type": "Enum",
"value": {
"range": [
"power_off",
"power_on",
"last"
]
}
},
"light_mode": {
"type": "Enum",
"value": {
"range": [
"relay",
"pos",
"none",
"on"
]
}
}
},
"status_range": {
"switch": {
"type": "Boolean",
"value": {}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
},
"add_ele": {
"type": "Integer",
"value": {
"min": 0,
"max": 50000,
"scale": 3,
"step": 100
}
},
"cur_current": {
"type": "Integer",
"value": {
"unit": "mA",
"min": 0,
"max": 100000,
"scale": 0,
"step": 1
}
},
"cur_power": {
"type": "Integer",
"value": {
"unit": "W",
"min": 0,
"max": 99999,
"scale": 1,
"step": 1
}
},
"cur_voltage": {
"type": "Integer",
"value": {
"unit": "V",
"min": 0,
"max": 5000,
"scale": 1,
"step": 1
}
},
"test_bit": {
"type": "Integer",
"value": {
"min": 0,
"max": 5,
"scale": 0,
"step": 1
}
},
"voltage_coe": {
"type": "Integer",
"value": {
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"electric_coe": {
"type": "Integer",
"value": {
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"power_coe": {
"type": "Integer",
"value": {
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"electricity_coe": {
"type": "Integer",
"value": {
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"fault": {
"type": "Bitmap",
"value": {
"label": [
"ov_cr",
"ov_vol",
"ov_pwr",
"ls_cr",
"ls_vol",
"ls_pow"
]
}
},
"relay_status": {
"type": "Enum",
"value": {
"range": [
"power_off",
"power_on",
"last"
]
}
},
"light_mode": {
"type": "Enum",
"value": {
"range": [
"relay",
"pos",
"none",
"on"
]
}
},
"child_lock": {
"type": "Boolean",
"value": {}
}
},
"status": {
"switch": true,
"countdown_1": 0,
"add_ele": 20,
"cur_current": 243,
"cur_power": 380,
"cur_voltage": 2322,
"test_bit": 1,
"voltage_coe": 0,
"electric_coe": 0,
"power_coe": 0,
"electricity_coe": 0,
"fault": 0,
"relay_status": "last",
"light_mode": "relay",
"child_lock": false
},
"home_assistant": {
"name": "Log Cabin meter",
"name_by_user": null,
"disabled": false,
"disabled_by": null,
"entities": [
{
"disabled": false,
"disabled_by": null,
"entity_category": "config",
"device_class": null,
"original_device_class": null,
"icon": null,
"original_icon": "mdi:account-lock",
"unit_of_measurement": null,
"state": {
"entity_id": "switch.log_cabin_meter_child_lock",
"state": "off",
"attributes": {
"icon": "mdi:account-lock",
"friendly_name": "Log Cabin meter Child Lock"
},
"last_changed": "2022-12-26T07:11:04.359136+00:00",
"last_updated": "2022-12-26T07:11:04.359136+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": null,
"original_device_class": null,
"icon": null,
"original_icon": null,
"unit_of_measurement": null,
"state": {
"entity_id": "switch.log_cabin_meter_switch",
"state": "on",
"attributes": {
"friendly_name": "Log Cabin meter Switch"
},
"last_changed": "2022-12-26T07:11:04.359247+00:00",
"last_updated": "2022-12-26T07:11:04.359247+00:00"
}
}
]
}
}
}