lkempf / casambi-bt Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
A write command on the ble "wire" to turn the device on looks like:
0200 43A2 9600 0203 0254 FF
The first 6 bytes contain the magic (the first bits seem to be constant 02
and the last 00
) so 4 magic/unknown bytes.
Byte 7 starts with a counter, then probably opcode (or unit id) and length followed by the arguments, 54 FF
which are the brightness and the temperature.
Other examples:
02D4 1712 FF00 0303 0200 FF # off, same connection as above
02BC 2754 2E00 0203 0254 FF #on (brigtness = 54), another connection
02B6 4C70 6C00 0303 0200 FF #off
The first message from the luminaire looks like this:
25AA 335E 507E AD73 03A2 4D05 00
or
5E62 CE74 5AFC 8793 03A2 4D05 00
8 unknown bytes followed by the state of the luminaire, I would guess.
Any ideas on how to continue, figure out how to compute the magic?
Importing the CasambiBt package via
from CasambiBt import Casambi, discover
results in an error:
Datei '/home/smarthome/.local/lib/python3.8/site-packages/CasambiBt/errors.py', Zeile 14
function ConnectionStateError(), Exception: unsupported operand type(s) for |: 'type' and 'NoneType'
Test is run under python 3.8.6.
Any help is appreciated. Thanks and best regards
I See the following warning a lot in my home assistant logs, about 500 times in a short time frame (some minutes)
``
WARNING (MainThread) [CasambiBt._client] Packet type 7 not implemented. Ignoring!
I am not sure what packet type this is but it doesn't seems to cause any problems for me so maybe we should lower this message to debug/info level instead?
Thanx for this integration!
All light are being detected OK and work fine with on/off. However is the percentage of brightness is changed it seems that the values are screwed up somehow.
If i raise brightness in the casambi APP to say 17%, HA does the same thing 17%. Perfect.
If i raise brightness in the casambi APP to say 37%, HA sets the slider to 12%. (subtracts 25)
If i raise brightness in the casambi APP to say 57%, HA sets the slider to 7%. (subtracts 50)
If i raise brightness in the casambi APP to say 77%, HA sets the slider to 2%. (subtracts 75)
The other way around will always set the slider to a value to or below 25%. Everything above will trigger an error
byte must be in range(0, 256)
I use several LEDs GO BL-TED & Casambi CBU-TED dimmers (same) that do have this issue, they operate 230V lights
I also have a Casambi CBU-PWM4 Ledstrip dimmer and a TCI dimmer that don't have this issue.
Hello, first of all, thanks for this fantastic piece of software. I'm very happy to have it in Home Assistant via an integration!
In the official Casambi app, you have a button on the bottom left - "re-enable automation". Asthe name suggests, this removes the manual override of human actions and 'resets' the control to the sensors etc. Is it possible to have this feature in the library?
My luminaires have multiple dimmers:
Unit(
_typeId=22133, deviceId=1, uuid='x', address='x', name='CURVED ',
firmwareVersion='9472', unitType=UnitType(id=22133, model='CURVED ',
manufacturer='OLIGO', mode='PWM/4ch/Dim,Dim,TW', stateLength=3, controls=[
UnitControl(type=<UnitControlType.DIMMER: 0>, offset=0, length=8, default=128, readonly=False),
UnitControl(type=<UnitControlType.DIMMER: 0>, offset=8, length=8, default=128, readonly=False),
UnitControl(type=<UnitControlType.UNKOWN: 99>, offset=16, length=8, default=46, readonly=False)
]), _state=None, _on=False, _online=True)
I changed the password of my network. Now I get errors in the home assistant integration which still persists even when I change the password back to what it was.
2023-11-10 23:16:17.940 INFO (MainThread) [CasambiBt._casambi] Trying to connect to casambi network 41:...:F1...
2023-11-10 23:16:17.941 INFO (MainThread) [CasambiBt._keystore] Loading keys...
2023-11-10 23:16:17.943 INFO (MainThread) [CasambiBt._keystore] Loaded 1 keys.
2023-11-10 23:16:17.943 INFO (MainThread) [CasambiBt._network] Loading session...
2023-11-10 23:16:17.944 INFO (MainThread) [CasambiBt._network] Loading unit type cache...
2023-11-10 23:16:17.945 INFO (MainThread) [CasambiBt._network] Getting network id...
2023-11-10 23:16:18.159 INFO (MainThread) [CasambiBt._network] Got network id 64i...xD.
2023-11-10 23:16:18.159 INFO (MainThread) [CasambiBt._network] Updating network...
2023-11-10 23:16:18.162 INFO (MainThread) [CasambiBt._network] Loaded cached network. Revision: 24
2023-11-10 23:16:18.202 ERROR (MainThread) [CasambiBt._network] Update failed: 410
2023-11-10 23:16:18.202 ERROR (MainThread) [custom_components.casambi_bt.config_flow] Unexpected exception
File "/config/custom_components/casambi_bt/config_flow.py", line 139, in async_step_user
File "/config/custom_components/casambi_bt/config_flow.py", line 55, in _validate_input
File "/usr/local/lib/python3.11/site-packages/CasambiBt/_casambi.py", line 138, in connect
File "/usr/local/lib/python3.11/site-packages/CasambiBt/_network.py", line 197, in update
CasambiBt.errors.NetworkUpdateError: Could not update network!
Any idea how to fix it?
To be honest, the password flow in the casaba app is not that reliable. I changed the password, but it looks like it's not able to persist it, the field is empty after I store it.
Hi there? Do you have any plan to support 0-10 dimmers? Model CBU-ASD (0/1-10)
My luminaires have a tunable white control which is not detected:
Unit(
_typeId=22133, deviceId=1, uuid='x', address='x', name='CURVED ',
firmwareVersion='9472', unitType=UnitType(id=22133, model='CURVED ',
manufacturer='OLIGO', mode='PWM/4ch/Dim,Dim,TW', stateLength=3, controls=[
UnitControl(type=<UnitControlType.DIMMER: 0>, offset=0, length=8, default=128, readonly=False),
UnitControl(type=<UnitControlType.DIMMER: 0>, offset=8, length=8, default=128, readonly=False),
UnitControl(type=<UnitControlType.UNKOWN: 99>, offset=16, length=8, default=46, readonly=False)
]), _state=None, _on=False, _online=True)
Hi Lkempf,
I am quite interested by your work but so far I was not being able to make it running. It give me an error 404 in the api call ""https://api.casambi.com/network/uuid/{mac.replace(':', '')}"".
So my questions are: what is it missing? Do I need an API key - knowing that casambi does not renew those keys this is problematic? Should I configure a "site"? Which password is requested as with a site we have an email/password?
Thanks in advance
m3xiz
It might useful to have a mode where no network is needed ( do a casa.connect(device)
instead of casa.connect(device,password)
). As far as I understand, if the unit info is stored (controls & keys), all the rest is direct BT communication. You would only need to connect once to get the necessary unit info and keys.
If you like I can look into that (I'm no real developer but I can write some code).
Is your feature request related to a problem? Please describe.
It would be nice it the casambi integration would store it's data in the /config/.storage
folder for a better overview.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.