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

home-assistant-custom-lovelace-modules.dirigera_platform: init at 2.6.4 #350542

Conversation

rhoriguchi
Copy link
Contributor

@rhoriguchi rhoriguchi commented Oct 22, 2024

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@rhoriguchi rhoriguchi force-pushed the home-assistant-custom-lovelace-modules.dirigera_platform branch from 189a643 to 764714a Compare October 22, 2024 19:55
@rhoriguchi rhoriguchi force-pushed the home-assistant-custom-lovelace-modules.dirigera_platform branch 6 times, most recently from 243e5d0 to b8131b6 Compare October 28, 2024 13:19
@rhoriguchi rhoriguchi force-pushed the home-assistant-custom-lovelace-modules.dirigera_platform branch from b8131b6 to 6a8e952 Compare November 6, 2024 10:21
@rhoriguchi rhoriguchi force-pushed the home-assistant-custom-lovelace-modules.dirigera_platform branch from 6a8e952 to 097750e Compare November 10, 2024 06:05
@rhoriguchi rhoriguchi changed the title home-assistant-custom-lovelace-modules.dirigera_platform: init at 2.3 home-assistant-custom-lovelace-modules.dirigera_platform: init at 2.6.4 Nov 10, 2024
@rhoriguchi rhoriguchi marked this pull request as ready for review November 10, 2024 14:12
@nix-owners nix-owners bot requested a review from mweinelt November 10, 2024 14:14
@mweinelt mweinelt merged commit 2544da7 into NixOS:master Nov 10, 2024
9 of 11 checks passed
@rhoriguchi rhoriguchi deleted the home-assistant-custom-lovelace-modules.dirigera_platform branch November 10, 2024 18:28
@mweinelt
Copy link
Member

mweinelt commented Nov 24, 2024

Turns out this does not build after all. Does it accidentally depend on pydantic>=2?

dirigera> ______________________________ test_dict_to_scene ______________________________
dirigera> 
dirigera> fake_client = <src.dirigera.hub.abstract_smart_home_hub.FakeDirigeraHub object at 0x7ffff529e120>
dirigera> 
dirigera>     def test_dict_to_scene(fake_client: FakeDirigeraHub) -> None:
dirigera>         data1: Dict[str, Any] = {
dirigera>             "id": "c9bbf831-6dcd-4442-8195-53eedb66a598",
dirigera>             "info": {"name": "Tesscene", "icon": "scenes_clean_sparkles"},
dirigera>             "type": "userScene",
dirigera>             "triggers": [
dirigera>                 {
dirigera>                     "id": "f3ad4585-1a73-4e9c-9329-f926bedf509c",
dirigera>                     "type": "app",
dirigera>                     "triggeredAt": "2023-08-27T11:01:14.747Z",
dirigera>                     "disabled": False,
dirigera>                 }
dirigera>             ],
dirigera>             "actions": [
dirigera>                 {
dirigera>                     "id": "d0bf2ebf-3fcf-4e68-9810-0dc552e40388",
dirigera>                     "type": "deviceSet",
dirigera>                     "attributes": {"isOn": True, "lightLevel": 100},
dirigera>                 }
dirigera>             ],
dirigera>             "commands": [],
dirigera>             "createdAt": "2023-08-27T10:28:48.096Z",
dirigera>             "lastCompleted": "2023-08-27T11:01:14.767Z",
dirigera>             "lastTriggered": "2023-08-27T11:01:14.767Z",
dirigera>             "undoAllowedDuration": 30,
dirigera>             "lastUndo": "2023-08-27T10:29:33.049Z",
dirigera>         }
dirigera>     
dirigera>         scene1 = dict_to_scene(data1, fake_client)
dirigera>         assert scene1.id == TEST_ID
dirigera>         assert scene1.info.name == TEST_NAME
dirigera>         assert scene1.info.icon.value == TEST_ICON
dirigera>         assert scene1.last_completed == datetime.datetime.strptime(
dirigera>             TEST_LAST_COMPLETED, "%Y-%m-%dT%H:%M:%S.%f%z"
dirigera>         )
dirigera>     
dirigera>         data2: Dict[str, Any] = {
dirigera>             "id": "00a0a00a-0aa0-0000-a000-00a0000a0a00",
dirigera>             "info": {
dirigera>                 "name": "Night",
dirigera>                 "icon": "scenes_clean_sparkles"
dirigera>             },
dirigera>             "type": "userScene",
dirigera>             "triggers": [
dirigera>                 {
dirigera>                     "id": "0000a0a0-0a00-000a-0a00-aaaaaa000000",
dirigera>                     "type": "app",
dirigera>                     "triggeredAt": "2024-04-23T21:34:51.619Z",
dirigera>                     "disabled": False
dirigera>                 },
dirigera>                 {
dirigera>                     "id": "a0000000-a000-0000-aaaa-0aaa000aa000",
dirigera>                     "type": "controller",
dirigera>                     "triggeredAt": "2024-04-20T05:49:20.178Z",
dirigera>                     "disabled": False,
dirigera>                     "trigger": {
dirigera>                         "days": [
dirigera>                             "Mon",
dirigera>                             "Tue",
dirigera>                             "Wed",
dirigera>                             "Thu",
dirigera>                             "Fri",
dirigera>                             "Sat",
dirigera>                             "Sun"
dirigera>                         ],
dirigera>                         "controllerType": "shortcutController",
dirigera>                         "clickPattern": "doublePress",
dirigera>                         "buttonIndex": 0,
dirigera>                         "deviceId": "0000aaaa-0000-0000-aa00-0a0aa0a000a0_2"
dirigera>                     }
dirigera>                 },
dirigera>                 {
dirigera>                     "id": "a0000000-a000-0000-aaaa-0aaa000aa000",
dirigera>                     "type": "sunriseSunset",
dirigera>                     "triggeredAt": "2024-04-24T17:49:00.989Z",
dirigera>                     "disabled": False,
dirigera>                     "trigger": {
dirigera>                         "days": [
dirigera>                             "Tue",
dirigera>                             "Wed",
dirigera>                             "Sun",
dirigera>                             "Mon",
dirigera>                             "Fri",
dirigera>                             "Sat",
dirigera>                             "Thu"
dirigera>                         ],
dirigera>                         "type": "sunset",
dirigera>                         "offset": 0
dirigera>                     },
dirigera>                     "nextTriggerAt": "2024-04-25T17:49:00.000Z"
dirigera>                 }
dirigera>             ],
dirigera>             "actions": [],
dirigera>             "commands": [],
dirigera>             "createdAt": "2023-11-06T22:10:14.806Z",
dirigera>             "lastCompleted": "2024-04-24T05:13:24.352Z",
dirigera>             "lastTriggered": "2024-04-24T05:13:24.352Z",
dirigera>             "undoAllowedDuration": 30
dirigera>         }
dirigera>     
dirigera> >       scene2 = dict_to_scene(data2, fake_client)
dirigera> 
dirigera> tests/test_scenes.py:159: 
dirigera> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
dirigera> src/dirigera/devices/scene.py:148: in dict_to_scene
dirigera>     return Scene(dirigeraClient=dirigera_client, **data)
dirigera> pydantic/main.py:339: in pydantic.main.BaseModel.__init__
dirigera>     ???
dirigera> pydantic/main.py:1074: in pydantic.main.validate_model
dirigera>     ???
dirigera> pydantic/fields.py:892: in pydantic.fields.ModelField.validate
dirigera>     ???
dirigera> pydantic/fields.py:925: in pydantic.fields.ModelField._validate_sequence_like
dirigera>     ???
dirigera> pydantic/fields.py:1091: in pydantic.fields.ModelField._validate_singleton
dirigera>     ???
dirigera> pydantic/fields.py:881: in pydantic.fields.ModelField.validate
dirigera>     ???
dirigera> pydantic/fields.py:1098: in pydantic.fields.ModelField._validate_singleton
dirigera>     ???
dirigera> pydantic/fields.py:1154: in pydantic.fields.ModelField._apply_validators
dirigera>     ???
dirigera> pydantic/class_validators.py:337: in pydantic.class_validators._generic_validator_basic.lambda13
dirigera>     ???
dirigera> pydantic/main.py:711: in pydantic.main.BaseModel.validate
dirigera>     ???
dirigera> pydantic/main.py:339: in pydantic.main.BaseModel.__init__
dirigera>     ???
dirigera> pydantic/main.py:1074: in pydantic.main.validate_model
dirigera>     ???
dirigera> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
dirigera> 
dirigera> >   ???
dirigera> E   pydantic.errors.ConfigError: field "trigger" not yet prepared so type is still a ForwardRef, you might need to call Trigger.update_forward_refs().
dirigera> 
dirigera> pydantic/fields.py:857: ConfigError

@rhoriguchi
Copy link
Contributor Author

rhoriguchi commented Nov 24, 2024

I've noticed the same, when I use this PR as overlay it works. But when I use the latest nixpkgs unstable it fails. I can't figure out why it doesn't work.

I'm currently using it with this overlay with no issues.

pkgs.python3Packages.callPackage (import "${
        pkgs.fetchFromGitHub {
            owner = "NixOS";
            repo = "nixpkgs";
            rev = "097750eab077606b000f2c68d44225f488073cb8";
            hash = "sha256-abRod/lwME8j9ADG44/FDD62ECN2qOkyqlgGp1FGalo=";
          }
        }/pkgs/servers/home-assistant/custom-components/dirigera_platform/package.nix") { }

@qbit
Copy link
Contributor

qbit commented Nov 24, 2024

Does the system you have that overlay on have the pydantic update to 2.0?

@rhoriguchi
Copy link
Contributor Author

Yes, version 2.9.2. I've taken the dirigera path out of the systemd service running home assistant

> cat /nix/store/40kk25aj960xh2mj5xmc0i87z08alvkp-python3.12-dirigera-1.2.1/nix-support/propagated-build-inputs
/nix/store/xq8y47ncc2bmb287wswaxv2vxzzmg3r8-python3.12-pydantic-2.9.2 /nix/store/hzx37lg2l7km3v2bwz1cajgb845b0rsh-python3.12-requests-2.32.3 /nix/store/k0bx08rcf2ilf875xkp14iiblrg8cxf1-python3.12-websocket-client-1.8.0 /nix/store/px2nj16i5gc3d4mnw5l1nclfdxhry61p-python3-3.12.7

@mweinelt
Copy link
Member

python3.pkgs.dirigera should set meta.broken = lib.versionOlder pydantic.version "2"

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

Successfully merging this pull request may close these issues.

3 participants