bramstroker / homeassistant-powercalc

Custom component to calculate estimated power consumption of lights and other appliances

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom models not showing in UI

tektonnic opened this issue · comments

System Health details

System Information

version core-2024.1.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.63-haos-raspi
arch aarch64
timezone Europe/London
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.33.0
Stage running
Available Repositories 1382
Downloaded Repositories 46
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 11.4
update_channel stable
supervisor_version supervisor-2023.12.1
agent_version 1.6.0
docker_version 24.0.7
disk_total 116.7 GB
disk_used 19.4 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Git pull (7.13.1), Samba share (12.2.0), File editor (5.7.0), Terminal & SSH (9.8.1), Home Assistant Google Drive Backup (0.112.1), pigpio (1.5.2), Node-RED (17.0.2), Custom deps deployment (1.3.4), MariaDB (2.6.1), Bookstack (2.0.0), Mosquitto broker (6.4.0), SQLite Web (4.1.0), Uptime Kuma (0.12.0)
Dashboards
dashboards 4
resources 23
views 32
mode storage
Recorder
oldest_recorder_run 8 January 2024 at 03:45
current_recorder_run 17 January 2024 at 06:03
estimated_db_size 575.18 MiB
database_engine sqlite
database_version 3.41.2

Checklist

  • I have read the FAQ to see if there is a known solution to my problem.
  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

Following using powercalc-measure on separate VM I move the created model.json and hs.csv.gz files to HA, placing them in a model folder (e.g. LED Strip Lights, Chromecast Audio) nested in a manufacturer folder (e.g. Tuya, Google) within powercalc-custom-models.

Once populated the Powercalc UI will show the newly created (if new) Manufacturer in the drop down when adding a light/sensor but the Model ID’s are not in the subsequent drop down, the drop down is blank (if the manufacturer is new) or populated only with the library devices (if manufacturer not new).

An existing manufacturer/model for a linear profile is already working in this folder tree.

Reproduction steps

  1. Perform Measure
  2. Connect to HA via SMB, navigate to folder tree, use PUT to copy model.json and hs.csv.gz

...

Debug logs

2024-01-17 11:04:12.005 DEBUG (MainThread) [custom_components.powercalc.discovery] light.office_strip_light: Auto discovered model (manufacturer=Tuya, model=LED Strip Lights (unsupported))
2024-01-17 11:04:12.006 DEBUG (MainThread) [custom_components.powercalc.discovery] light.office_strip_light: Auto discovered model (manufacturer=Tuya, model=LED Strip Lights (unsupported))

Diagnostics dump or YAML config

No response

Please add the full directory / file tree which you have now under powercalc-custom-models directory.
Might help in reproducing / finding out why it's not working as expected.

Hey, please see below, let me know if you need anything else.

[core-ssh powercalc-custom-models]$ tree
.
├── Google inc
│   └── Chromecast `Audio
│       └── model.json
├── Tuya
│   └── Strip
│       ├── hs.csv.gz
│       └── model.json
└── innr
    └── RS 225
        └── model.json

6 directories, 4 files

Unable to reproduce yet.
I have tried with the Tuya -> Strip directory.

After selecting tuya at manufacturer the Strip model is appearing.

Screenshot 2024-01-17 at 17 59 00

You are sure you did restart after putting the directory and files? Anything relevant in the logs?

Yeah I’ve rebooted and no change, I tried to manually add the model to a sensor in configuration and get the following;

2024-01-17 13:36:53.466 ERROR (MainThread) [custom_components.powercalc.sensors.power] light.office_strip_light: Skipping sensor setup Model not found in library (manufacturer: Tuya, model: Strip)
2024-01-17 13:36:53.466 ERROR (MainThread) [custom_components.powercalc.sensors.power] light.office_strip_light: Skipping sensor setup: Model not found in library (manufacturer: Tuya, model: Strip)

Should the hierarchy be enough for it to show? Is the contents of the csv and json irrelevant at this point?

hmm strange. The data of csv is irrelevant at this point.
The model.json is important though. Can you share this?

Sure, I think it’s just the default from the measure script

{
    "calculation_strategy": "lut",
    "measure_description": "Measured with utils/measure script",
    "measure_device": "Tapo P110",
    "measure_method": "script",
    "measure_settings": {
        "SAMPLE_COUNT": 2,
        "SLEEP_TIME": 3,
        "VERSION": "v1.9.16:docker"
    },
    "name": "Tuya LED Strip",
    "standby_power": 0.49
}

Could you also try to lowercase both manufacturer and model directory, and remove whitespacing, and eliminate OS case sensitivity issues?
Just to keep it as simple as possible.

And you have put the files under config/powercalc-custom-models directory? Must be under the config directory of HA.

Hi - ok so I followed your instructions re naming (I was already in that directory) and now they are appearing. Interestingly I’d already tried doing what you suggested before raising a bug but all my renames were performed using the File Editor add-in, so I rebuilt the directories via ssh and now things are working (this is such a cool integration btw, thank you for building and maintaining it). So perhaps File Editor was adding extra characters or whitespace? It’s not very clear…

Nice you got it working now.
It should also work with spaces, so not really sure why it wasn't working for you before.
But let's not waste any more of our time on it ;-)
Glad you like the integration, yes I do my best to maintain it to my best abilities.

Closing this issue.