Commit graph

4027 commits

Author SHA1 Message Date
f7e8cfe5a7
Don't include unit in BLE sensors when they are matched against the native type.
It's likely to just include the native type name anyway.
2023-03-22 14:14:59 +01:00
486f37a45e
Support sensor value reported both on value as well as _value fields. 2023-03-22 14:11:13 +01:00
bfc87e0f7b
Display arrays and objects in the entity modal as prettified JSON. 2023-03-22 13:50:35 +01:00
c750d83188
Prevent name collisions on bluetooth.ServiceClass. 2023-03-22 03:27:25 +01:00
174b1ee6a9
Use a default list of excluded Bluetooth manufacturers. 2023-03-21 16:03:01 +01:00
e9abb5cb9a
Implemented support for child entities in entity modals. 2023-03-21 16:02:02 +01:00
b1cb7ef847
Added a list of excluded_manufacturers to BluetoothPlugin. 2023-03-21 14:32:45 +01:00
718e0434ba
Display all available entity attributes on EntityModal. 2023-03-20 14:32:03 +01:00
78bbe71be1
Another .pull-right fix. 2023-03-20 02:04:32 +01:00
3743ee4f00
s/TheengsGateway/TheengsDecoder/g now that the pip package has been published. 2023-03-20 01:41:21 +01:00
431dedf3eb
BluetoothDevice moved to its own component, with device connect support. 2023-03-20 01:28:12 +01:00
0a4b22c12e
Implemented connect/disconnect call on BluetoothService component. 2023-03-20 01:27:47 +01:00
714f853751
Pass the list of children to the entity component. 2023-03-20 01:27:21 +01:00
a011de890b
Better .pull-right class implementation. 2023-03-20 01:26:48 +01:00
2b5596820b
Made Types.objectsEqual method more robust against null input 2023-03-19 22:50:23 +01:00
71a3481560
Better style for the sidebar/nav 2023-03-19 22:23:37 +01:00
12096f2dbe
Don't fail hard when device disconnection fails. 2023-03-19 12:56:53 +01:00
40f81b105f
Set the connected flag when connecting/disconnecting from a service. 2023-03-19 12:56:31 +01:00
9d66b63266
BluetoothService attributes fixes.
BluetoothService IDs should always be in the format `address::uuid` and
the name should always be in title format.
2023-03-19 12:55:14 +01:00
6e9263c4e4
A more elegant logic to infer the manufacturer name. 2023-03-19 12:54:52 +01:00
b568876474
Use a service's UUID as a name instead of Unknown if the service is unknown. 2023-03-19 12:54:09 +01:00
aa04741daa
Added BluetoothService UI component 2023-03-19 12:53:23 +01:00
f74fab795d
Added parent component value to Entity. 2023-03-19 12:50:45 +01:00
243de15813
Added connected flag to BluetoothService. 2023-03-19 12:49:38 +01:00
256d9adbf2
Removed children from BluetoothDevice.to_json - it makes events too verbose 2023-03-19 12:48:11 +01:00
4144e4f842
Fixed self._ip_to_dev expansion 2023-03-19 12:47:07 +01:00
878fe91155
Big rewrite/refactor of the entities merger 2023-03-19 12:40:48 +01:00
2411b961e8
[WIP] Big, big refactor of the Bluetooth integration.
- Merged together Bluetooth legacy and BLE plugins and scanners.
- Introduced Theengs as a dependency to infer BLE device types and
  create sub-entities appropriately.
- Using `BluetoothDevice` and `BluetoothService` entities as the bread
  and butter for all the Bluetooth plugin's components.
- Using a shared cache of devices and services between the legacy and
  BLE integrations, with merging/coalescing logic included.
- Extended list of discoverable services to include all those officially
  supported by the Bluetooth specs.
- Instantiate a separate pool of workers to discover services.
- Refactor of the Bluetooth events - all of them are now instantiated
  from a single `BluetoothDevice` object.
2023-03-13 02:31:21 +01:00
4bc61133c5
The Entity object should also have a to_json method. 2023-03-12 23:01:51 +01:00
4a8da80c7c
Don't join self._thread on stop in RunnablePlugin if self._thread = current_thread 2023-03-11 23:45:46 +01:00
31552963c4
EntitiesDb.upsert should return a deep copy of the upserted entities.
Not the upserted entities themselves, no matter if expunged or made transient.

Reminder to my future self: returning the flushed entities and then using them
outside of the session or in another thread opens a big can of worms when using
SQLAlchemy.
2023-03-10 12:06:36 +01:00
f45e47363d
Use lazy='joined' instead of lazy='selectin' on Entity.parent.
That's the best way to ensure that all the columns are fetched eagerly and
prevent errors later when trying to access lazily loaded attributes outside
of the session/thread.
2023-03-10 12:01:23 +01:00
8ccf3e804d
Added utility get_entities_engine() function. 2023-03-10 11:49:23 +01:00
60da930e4b
Added support for get_plugin(MyPlugin) besides get_plugin('my'). 2023-03-10 11:47:39 +01:00
3fcc9957d1
A dirty fix to prevent DetachedInstanceError when accessing the parent entity. 2023-03-10 11:45:44 +01:00
ceb7a2f098
EntitiesEngine synchronization improvements.
- Added `wait_start()` method that other threads can use to synchronize
  with the engine and wait before performing db operations.

- Callback logic wrapped in a try/except block to prevent custom
  integrations with buggy callbacks from crashing the engine.
2023-03-10 00:57:24 +01:00
73dc2463f1
Added auto_commit=False to entities.save() 2023-03-10 00:40:51 +01:00
7e92d5f244
Added recursive .copy() method to Entity. 2023-03-09 22:35:31 +01:00
9f9ee575f1
Added _import_error_ignored_modules.
ImportErrors on these entity modules will be ignored when dynamically
loading them, since they have optional external dependencies and we
shouldn't throw an error if we can't import them.
2023-03-09 01:40:35 +01:00
c4efec6832
Several fixes and improvements on the entities engine.
- Support for an optional callback on `publish_entities` to get notified
  when the published object are flushed to the db.

- Use `lazy='selectin'` for the entity parent -> children relationship -
  it is more efficient and it ensures that all the data the application
  needs is loaded upfront.

- `Entity.entity_key` rolled back to `<external_id, plugin>`. The
  fallback logic on `<id, plugin>` created more problems than those it
  as supposed to solve.

- Added `expire_on_commit=False` to the entities engine session to make
  sure that we don't get errors on detached/expired instances.
2023-03-09 01:16:04 +01:00
1781a19a79
s/Entity.to_json/Entity.to_dict/g
stuff
2023-03-06 23:46:33 +01:00
b9efa9fa30
entity_key should coalesce (entity.external_id or entity.id) 2023-03-06 16:54:02 +01:00
72c55c03f2
[WIP] Refactoring/extending models and parsers for Bluetooth entities. 2023-03-03 02:10:11 +01:00
a688e7102e
Changed default poll_interval for RunnablePlugin.
30 -> 15 seconds.
2023-03-03 02:00:48 +01:00
ead4513915
Added optional unit column to RawSensor entity. 2023-03-03 01:59:27 +01:00
94c4e52154
Mock PyOBEX.client in readthedocs conf.py 2023-03-03 01:58:32 +01:00
7be55e446f
Convert UUID objects to strings when serializing to JSON. 2023-03-02 21:58:26 +01:00
15fadb93bb
Added stand-alone connect and disconnect actions to bluetooth. 2023-02-25 01:59:35 +01:00
70d1bb893c
A cleaner way of calculating the success response attribute. 2023-02-25 01:58:09 +01:00
2dfb389630
Added remaining bluetooth entity types in _mappers.py. 2023-02-23 21:20:41 +01:00