lkempf / casambi-bt-hass

33 stars 12 forks source link

Support for networks with classic firmware #6

Open robsonke opened 1 year ago

robsonke commented 1 year ago

When I run the demo, it asks for the right network and password, so far so good. When I continue it prints the json of the network but it fails on the keyStore, since that's not part of my json.

Error:

Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at /addons/casambi-bt-main/demo.py:12> exception=KeyError('keyStore')>
Traceback (most recent call last):
  File "/addons/casambi-bt-main/demo.py", line 29, in main
    await casa.connect(device, pwd)
  File "/addons/casambi-bt-main/src/CasambiBt/_casambi.py", line 124, in connect
    await self._casaNetwork.update()
  File "/addons/casambi-bt-main/src/CasambiBt/_network.py", line 149, in update
    keys = resJson["network"]["keyStore"]["keys"]
KeyError: 'keyStore'

I'm on a Classic network which I cannot upgrade (devices are too old). If you want, I can share my json too, but I'll remove some fields that might be sensitive.

robsonke commented 1 year ago
{
   "status":"FETCHED",
   "revision":385.0,
   "network":{
      "id":"",
      "revision":385,
      "generation":8,
      "lastUsedProtocol":0,
      "channels":2852,
      "mode":1,
      "grade":0,
      "uuid":"57e7157e24cb",
      "gateway":{
         "token":"",
         "name":"",
         "notify":true,
         "options":499711,
         "values":{
            "T1":0.0,
            "T2":0.0
         }
      },
      "site":"",
      "email":"",
      "name":"",
      "visitorKey":"",
      "managerKey":"",
      "type":2,
      "nextSceneID":0,
      "nextUnitID":30,
      "nextEventID":2,
      "nextControlID":0,
      "nextGroupID":4,
      "protocolVersion":5,
      "allUnitPosition":-1,
      "nearUnitPosition":-1,
      "nearbyEnabled":true,
      "allowPrototypes":false,
      "longitude":3.9,
      "latitude":51.5,
      "timeZone":"Europe/Amsterdam",
      "settings":{
         "revision":1,
         "control":{
            "useLastLevels":true,
            "enabled":false,
            "activateTimersAfterStartup":false,
            "startupDuration":100,
            "tapDuration":100,
            "dimDuration":500,
            "fadeout":10,
            "behaviour":1,
            "weekdays":[
               {
                  "weekday":2,
                  "dayStart":7,
                  "dayEnd":18,
                  "dayTimeout":120,
                  "nightTimeout":30
               },
               {
                  "weekday":4,
                  "dayStart":7,
                  "dayEnd":18,
                  "dayTimeout":120,
                  "nightTimeout":30
               },
               {
                  "weekday":8,
                  "dayStart":7,
                  "dayEnd":18,
                  "dayTimeout":120,
                  "nightTimeout":30
               },
               {
                  "weekday":16,
                  "dayStart":7,
                  "dayEnd":18,
                  "dayTimeout":120,
                  "nightTimeout":30
               },
               {
                  "weekday":32,
                  "dayStart":7,
                  "dayEnd":18,
                  "dayTimeout":120,
                  "nightTimeout":30
               },
               {
                  "weekday":64,
                  "dayStart":9,
                  "dayEnd":16,
                  "dayTimeout":120,
                  "nightTimeout":30
               },
               {
                  "weekday":1,
                  "dayStart":9,
                  "dayEnd":16,
                  "dayTimeout":120,
                  "nightTimeout":30
               }
            ]
         }
      },
      "grid":{
         "type":0,
         "position":0,
         "groupID":0,
         "cells":[
            {
               "type":3,
               "position":0,
               "groupID":0
            },
            {
               "type":4,
               "position":1,
               "groupID":0
            },
            {
               "type":1,
               "position":6,
               "groupID":0,
               "unit":9
            },
            {
               "type":1,
               "position":5,
               "groupID":0,
               "unit":13
            },
            {
               "type":2,
               "position":7,
               "groupID":1,
               "name":"Overloop",
               "cells":[
                  {
                     "type":1,
                     "position":0,
                     "groupID":0,
                     "unit":15
                  },
                  {
                     "type":1,
                     "position":1,
                     "groupID":0,
                     "unit":16
                  }
               ]
            },
            {
               "type":1,
               "position":2,
               "groupID":0,
               "unit":17
            },
            {
               "type":1,
               "position":8,
               "groupID":0,
               "unit":31
            },
            {
               "type":1,
               "position":9,
               "groupID":0,
               "unit":29
            },
            {
               "type":2,
               "position":4,
               "groupID":3,
               "name":"Slaapkamer kast en douche",
               "cells":[
                  {
                     "type":1,
                     "position":0,
                     "groupID":0,
                     "unit":11
                  },
                  {
                     "type":1,
                     "position":1,
                     "groupID":0,
                     "unit":12
                  }
               ]
            },
            {
               "type":1,
               "position":3,
               "groupID":0,
               "unit":10
            }
         ]
      },
      "photos":[

      ],
      "units":[
         {
            "deviceID":9,
            "uuid":"a48dd341-3a69-4fb9-be10-b17bad99fd4b",
            "address":"bc2760191445",
            "cpu":0,
            "name":"Slaapkamer Eva",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":8,
            "revision":1,
            "configRevision":1,
            "firmware":6680,
            "image":"K8WMTQBprbvVdvobjMVT2aEg4ZL71dUT",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":10,
            "uuid":"5e23c8d3-80aa-46b6-91ea-41035123be86",
            "address":"5e1ff2f02dd6",
            "cpu":0,
            "name":"Hoofdslaapkamer",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":9,
            "revision":3,
            "configRevision":9,
            "firmware":6680,
            "image":"RgoMu7sP9XocAXzMdGijUPQUI1RWMOTy",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"4401",
                  "cycle":true
               },
               {
                  "name":"unit_mode3",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode4",
                  "state":"fc03",
                  "cycle":true
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":11,
            "uuid":"90e951f7-dc16-42fb-9315-7d2946192072",
            "address":"5aa2311d22bf",
            "cpu":0,
            "name":"Inloopkast",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":3,
            "position":10,
            "revision":2,
            "configRevision":2,
            "firmware":6680,
            "image":"wSwzJ6HHOBAhpbs8JafUs2RJ4McRDxmF",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":12,
            "uuid":"034e1cdd-f756-4548-a222-d08cf6661030",
            "address":"3c0937aef5d1",
            "cpu":0,
            "name":"Douche",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":3,
            "position":11,
            "revision":2,
            "configRevision":2,
            "firmware":6680,
            "image":"Kimxi4Ao4l4OVH1X0YGYDOWzLufyBtea",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":13,
            "uuid":"892da70c-ace2-4a8b-ab75-1ea5024def66",
            "address":"11ab855abcb9",
            "cpu":0,
            "name":"Badkamer",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":12,
            "revision":1,
            "configRevision":4,
            "firmware":6680,
            "image":"rANcExMCRnBBC1zhrveZYkeiYe7Fz6gG",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":1,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":15,
            "uuid":"6bff3c26-00d6-4750-b62c-8ed43bc5812f",
            "address":"d8489baf7870",
            "cpu":0,
            "name":"Overloop 1",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":1,
            "position":14,
            "revision":1,
            "configRevision":2,
            "firmware":6680,
            "image":"epIoaUjZYdlkESHmQnxmAHGXB9rzkWNz",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":16,
            "uuid":"c1af33fc-7554-4be5-bf34-990a3d73306a",
            "address":"02b93cec5469",
            "cpu":0,
            "name":"Overloop 2",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":1,
            "position":15,
            "revision":1,
            "configRevision":2,
            "firmware":6680,
            "image":"GRQket0ysuF1vlvw6yn1LA5Ms29D4X6T",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":17,
            "uuid":"af0a4fc6-01d9-4138-90d2-fcc39cb31fc8",
            "address":"0623d0c2bc2f",
            "cpu":0,
            "name":"Hal",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":16,
            "revision":1,
            "configRevision":49,
            "firmware":6680,
            "image":"9b7OLbSLCXYHevqZFEyzAxp9UJ2wFhIh",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":19,
            "uuid":"5af264d5-3a38-4cd2-a297-3c98fb390395",
            "address":"31782b2723e3",
            "cpu":0,
            "name":"Schakelaar Slaapkamer 1",
            "type":239,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":18,
            "revision":2,
            "configRevision":9,
            "firmware":5377,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":3,
                     "target":3
                  },
                  {
                     "type":1,
                     "action":2,
                     "target":10
                  },
                  {
                     "type":2,
                     "action":2,
                     "target":11
                  },
                  {
                     "type":3,
                     "action":2,
                     "target":12
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":false,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":21,
            "uuid":"9078f790-fe56-49ee-b3ee-32871d72e65f",
            "address":"2495661afb85",
            "cpu":0,
            "name":"Schakelaar Overloop (dubbel)",
            "type":1045,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":20,
            "revision":1,
            "configRevision":13,
            "firmware":4864,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":2,
                     "target":17
                  },
                  {
                     "type":1,
                     "action":3,
                     "target":1
                  },
                  {
                     "type":2,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":3,
                     "action":0,
                     "target":0
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":true,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":22,
            "uuid":"0b2defed-0b95-4cf3-810a-4f6f71d5ad2b",
            "address":"9d423ad15ed6",
            "cpu":0,
            "name":"Schakelaar Overloop (enkel)",
            "type":1045,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":21,
            "revision":1,
            "configRevision":3,
            "firmware":6145,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":3,
                     "target":1
                  },
                  {
                     "type":1,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":2,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":3,
                     "action":0,
                     "target":0
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":true,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":23,
            "uuid":"f8cb8c17-6221-485a-acf9-a53209809709",
            "address":"2c7892bb800e",
            "cpu":0,
            "name":"Schakelaar Badkamer 2",
            "type":1045,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":22,
            "revision":1,
            "configRevision":4,
            "firmware":4864,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":2,
                     "target":13
                  },
                  {
                     "type":1,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":2,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":3,
                     "action":0,
                     "target":0
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":true,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":24,
            "uuid":"c273780b-5056-45f1-ba28-367346de4b4e",
            "address":"1eb4a77b6f1a",
            "cpu":0,
            "name":"Schakelaar Slaapkamer 2",
            "type":1045,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":23,
            "revision":1,
            "configRevision":2,
            "firmware":4864,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":2,
                     "target":9
                  },
                  {
                     "type":1,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":2,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":3,
                     "action":0,
                     "target":0
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":true,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":25,
            "uuid":"7a7c7379-be2e-4fea-bacf-cc31384e9809",
            "address":"9ace93ec775d",
            "cpu":0,
            "name":"Schakelaar Slaapkamer 3",
            "type":1045,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":24,
            "revision":1,
            "configRevision":6,
            "firmware":6145,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":2,
                     "target":29
                  },
                  {
                     "type":1,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":2,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":3,
                     "action":0,
                     "target":0
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":true,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":26,
            "uuid":"381b8b98-9f71-4e3a-ab9f-f008fcc6a01a",
            "address":"6112e84c26ac",
            "cpu":0,
            "name":"Schakelaar Slaapka",
            "type":1045,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":25,
            "revision":1,
            "configRevision":9,
            "firmware":6145,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":2,
                     "target":31
                  },
                  {
                     "type":1,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":2,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":3,
                     "action":0,
                     "target":0
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":true,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":27,
            "uuid":"e42e008b-c458-4bc6-9134-a9ccd5cc0d09",
            "address":"515337bf4476",
            "cpu":0,
            "name":"4CHANNEL_SW",
            "type":1045,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":25,
            "revision":1,
            "configRevision":5,
            "firmware":6145,
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"000000",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"000000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"000000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "linkedSensor":0,
            "gain":100.0,
            "switchConfig":{
               "buttons":[
                  {
                     "type":0,
                     "action":2,
                     "target":17
                  },
                  {
                     "type":1,
                     "action":3,
                     "target":1
                  },
                  {
                     "type":2,
                     "action":0,
                     "target":0
                  },
                  {
                     "type":3,
                     "action":0,
                     "target":0
                  }
               ],
               "switches":[

               ],
               "exclusiveScenes":false,
               "longPressAllOff":true,
               "toggleDisabled":false
            },
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":31,
            "uuid":"abc7a7df-991f-4be2-9829-56ff6ee4b5f4",
            "address":"820152c75e57",
            "cpu":0,
            "name":"Logeerkamer ",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":25,
            "revision":1,
            "configRevision":1,
            "firmware":6680,
            "image":"cgiSeLh8xHi9EW41EpxN6cCc8B0cy28L",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         },
         {
            "deviceID":29,
            "uuid":"aa7d6114-6ddf-4fe9-a577-efc28b0aaabe",
            "address":"b7a383cd1d96",
            "cpu":0,
            "name":"Zolder",
            "type":983,
            "appearance":0,
            "hueID":0,
            "groupID":0,
            "position":25,
            "revision":1,
            "configRevision":1,
            "firmware":6680,
            "image":"feI6kMNjKU3GQYVcaeYaSDd8igRzQzue",
            "modes":[
               {
                  "name":"unit_mode1",
                  "state":"fc03",
                  "cycle":true
               },
               {
                  "name":"unit_mode2",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode3",
                  "state":"0000",
                  "cycle":false
               },
               {
                  "name":"unit_mode4",
                  "state":"0000",
                  "cycle":false
               }
            ],
            "smartSwitch":{
               "type":0,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "pushButtonToggleDisabled":false,
            "presenceSensor":{
               "type":5,
               "id":0,
               "scenes":[

               ],
               "scenes2":[

               ],
               "group":0,
               "unit":0,
               "lingerTime":120,
               "fadeTime":10,
               "switchOffFadeTime":0,
               "switchOffDelayTime":0,
               "excludeOFF":false,
               "disableDimming":false,
               "index":0
            },
            "linkedSensor":0,
            "gain":100.0,
            "startupMode":0,
            "minOnLevel":0.0,
            "minLevel":0.0,
            "maxLevel":1.0,
            "parameters":[

            ],
            "sequenceCounter":0,
            "behaviour":0,
            "timeout":0,
            "labels":{

            },
            "details":{

            },
            "actionConfig":0,
            "actions":[

            ]
         }
      ],
      "scenes":[

      ],
      "events":[

      ],
      "circadianProfiles":[

      ],
      "gwT1":0,
      "gwT2":0
   },
   "role":3
}
lkempf commented 1 year ago

I think the issue is that your network doesn't have any keys. I've tried to implement support for networks without keys but couldn't test it since I can't get the network I have access to into this configuration. Could you test demo.py with the version I just pushed? You can use pip install -e . to install this version in your venv.

robsonke commented 1 year ago

Thanks. It's coming a lot further, though still crashing:

........
Fetching unit type for id 1045...
Using cached type.
Fetching unit type for id 983...
Using cached type.
Fetching unit type for id 983...
Using cached type.
Saving type cache...
Network updated.
Connection to 57:E7:15:7E:24:CB
Received disconnect callback from 57:E7:15:7E:24:CB
Connected to 57:E7:15:7E:24:CB
Starting key exchange...
Got b'007c7201583137ae1da24d0500'
Disconnecting...
Received disconnect callback from 57:E7:15:7E:24:CB
Disconnected.
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at /addons/casambi-bt-main/demo.py:10> exception=ProtocolError('Unexpected answer from device! Wrong device or protocol version?')>
Traceback (most recent call last):
  File "/addons/casambi-bt-main/demo.py", line 26, in main
    await casa.connect(device, pwd)
  File "/addons/casambi-bt-main/src/CasambiBt/_casambi.py", line 126, in connect
    await self._connectClient()
  File "/addons/casambi-bt-main/src/CasambiBt/_casambi.py", line 141, in _connectClient
    raise e
  File "/addons/casambi-bt-main/src/CasambiBt/_casambi.py", line 137, in _connectClient
    await self._casaClient.exchangeKey(self._casaNetwork.getKeyStore())
  File "/addons/casambi-bt-main/src/CasambiBt/_client.py", line 144, in exchangeKey
    raise ProtocolError(
CasambiBt.errors.ProtocolError: Unexpected answer from device! Wrong device or protocol version?
lkempf commented 1 year ago

Are you using the classic firmware? That one uses a completely different handshake as far as I can tell.

robsonke commented 1 year ago

I'm on a Classic network which I cannot upgrade (devices are too old).

yep ;)

lkempf commented 1 year ago

Ok. I might look into that when I have time but it isn't a priority for me right now. If you want some pointers on how to implement this yourself I might be able to help you get started but you would need a rooted Android phone. As far as I know the only differences are the handshake and that the color is set differently (although that part is mostly implemented already).

robsonke commented 1 year ago

I'm happy to help, I don't have Python experience but enough developer skills, just no clue on the Casambi protocol and not owning a single android device :)

sMauldaeschle commented 1 year ago

I am seeing the same error and my network is Classic as well.

2022-12-26 17:20:20.018 INFO (MainThread) [CasambiBt._casambi] Trying to connect to casambi network 17:14:F5:D1:70:2B...
2022-12-26 17:20:20.018 INFO (MainThread) [CasambiBt._network] Getting network id...
2022-12-26 17:20:20.153 INFO (MainThread) [CasambiBt._network] Got network id <network_id_removed>.
2022-12-26 17:20:20.156 INFO (MainThread) [CasambiBt._network] Loading session...
2022-12-26 17:20:20.159 INFO (MainThread) [CasambiBt._network] Updating network...
2022-12-26 17:20:20.230 ERROR (MainThread) [custom_components.casambi-bt.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/casambi-bt/config_flow.py", line 119, in async_step_user
    info = await _validate_input(self.hass, user_input)
  File "/config/custom_components/casambi-bt/config_flow.py", line 41, in _validate_input
    await casa.connect(bt_device, data[CONF_PASSWORD])
  File "/usr/local/lib/python3.10/site-packages/CasambiBt/_casambi.py", line 124, in connect
    await self._casaNetwork.update()
  File "/usr/local/lib/python3.10/site-packages/CasambiBt/_network.py", line 148, in update
    keys = resJson["network"]["keyStore"]["keys"]
KeyError: 'keyStore'

I have an old Galaxy with Android 5 that I could root. But I don't know if I am able to fix that. At least I can give it a try once I find some time which is the other issue :)

lkempf commented 1 year ago

According to the manifest of the Casambi App I'm using Android 5 is still supported. Feel free to get back to me (or anyone else who wants to help out) once you have a rooted Android phone running frida-server. I can then tell you how to recover the debug log generated by the app and this should be sufficient to implement the handshake.

hellqvio86 commented 1 year ago

I also have a Casambi classic network that I can't upgrade due to old hardware.

I resurrected Nexus 6p (latest android phone I have that I can root) its running an old unsupported android, getprop output:

[ro.build.date]: [Fri Oct 19 16:45:06 UTC 2018]
[ro.build.date.utc]: [1539967506]
[ro.build.description]: [angler-user 8.1.0 OPM7.181205.001 5080180 release-keys]
[ro.build.display.id]: [OPM7.181205.001]
[ro.build.expect.baseband]: [angler-03.88]
[ro.build.expect.bootloader]: [angler-03.84]
[ro.build.fingerprint]: [google/angler/angler:8.1.0/OPM7.181205.001/5080180:user/release-keys]
[ro.build.flavor]: [angler-user]
[ro.build.host]: [wpiv1.hot.corp.google.com]

And I also got frida-server running on it, please say what debug logs you are looking for and I can extract them for you with frida.

lkempf commented 1 year ago

Great. Can you send me a mail (see profile) so that I can give you some files? I don't really want to publish some of them.

lkempf commented 1 year ago

I've received the logs from @hellqvio86 but they are a lot harder to read than the logs for the evolution firmware. Thanks for that. The good news is that as far as I can tell there is no cryptography involved. This should make implementing the protocol a lot simpler. I'm not sure yet whether it's feasible for anyone to help me with this.

sMauldaeschle commented 1 year ago

I was able to root my Galaxy S4 with dr.fone. But I did not get frida running. I am using a VirtualBox VM with Ubuntu and installed everything here and there. But the phone sometimes disconnects, sometimes crashes and I cannot get a connection. Lot's a google did not get me there. But I wonder if more logs will be of any help. I'll shoot out an email to you if you want to share things with me with respect to implementing the different handshake.

hellqvio86 commented 1 year ago

I had to run frida 16.0.1 on my rooted android phone, latest release just crashed out on me, I am running the client on from a Linux laptop. Happy to help out with the development effort, new to bluetooth le through.

lkempf commented 1 year ago

My results so far:

When subscribing to the BLE characteristic the first response of the unit is:

The optional parts are set by making the packet longer. I haven't fully understood which UUID is used and it depends on whether the device is conformant. I'd just assume that this is true and I'd guess its just CASA_AUTH_CHAR_UUID. Could anyone here send me which characteristics are provided by the network?

After this the messages start to get signed and the header format depends on the role (none, visitor, manager). I think I've got about half of what's going on there and I will try to only focus on visitor.

hellqvio86 commented 1 year ago

@lkempf I have mailed you the btsnoop_hci logs from the device, hope you can get the characteristics from it :slightly_smiling_face:

sMauldaeschle commented 1 year ago

I had to run frida 16.0.1 on my rooted android phone, latest release just crashed out on me, I am running the client on from a Linux laptop. Happy to help out with the development effort, new to bluetooth le through.

Great, that did the trick! Saved my more hours of Google... @lkempf I sent you an email. You can send me more infos now since I should be ready to try with my phone now as well.

sMauldaeschle commented 10 months ago

From my logs I can confirm that the UUID CASA_AUTH_CHAR_UUID is used. Logs are out.

krangchen commented 7 months ago

Any progress here? I can root an old Galaxy S4 mini if of any help, my S3 just died with lineage... You guys are my last hope as stupid casambi denied me an API and I even had this too expensive Lithernet Gateway where they also recently upgrade the firmware to be incompatible with classic. Ripping half the house apart to change to e.g. Shelly would be another option for about 5k as well :/