{"id":46333,"library":"sensor-state-data","title":"sensor-state-data","description":"Models for storing and converting SensorData state from Bluetooth devices. Current version 2.20.0, last updated 2024. Released on PyPI, maintained actively with monthly releases.","status":"active","version":"2.20.0","language":"python","source_language":"en","source_url":"https://github.com/bluetooth-devices/sensor-state-data","tags":["bluetooth","sensor-data","models","home-assistant"],"install":[{"cmd":"pip install sensor-state-data","lang":"bash","label":"Latest stable"}],"dependencies":[],"imports":[{"note":"Library uses underscores in package name","wrong":"from sensorstatedata import SensorDeviceInfo","symbol":"SensorDeviceInfo","correct":"from sensor_state_data import SensorDeviceInfo"},{"note":"","wrong":"","symbol":"SensorValue","correct":"from sensor_state_data import SensorValue"},{"note":"","wrong":"","symbol":"SensorUpdate","correct":"from sensor_state_data import SensorUpdate"}],"quickstart":{"code":"from sensor_state_data import SensorDeviceInfo, SensorValue, SensorUpdate\n\ndevice = SensorDeviceInfo(\n    name=\"Test Sensor\",\n    model=\"TestModel\",\n    manufacturer=\"TestCorp\",\n    sw_version=\"1.0\",\n    hw_version=\"1.0\",\n)\nvalue = SensorValue(\n    name=\"temperature\",\n    native_unit=\"°C\",\n    native_value=25.0,\n)\nupdate = SensorUpdate(\n    device_info=device,\n    sensor_values=[value],\n    timestamp=1234567890.0,\n)\nprint(update)","lang":"python","description":"Example of creating a SensorUpdate object for a temperature sensor."},"warnings":[{"fix":"Use 'pip install sensor-state-data' and 'from sensor_state_data import ...'","message":"The package name contains hyphens but the import uses underscores: 'sensor-state-data' vs 'sensor_state_data'. Typo in import leads to ModuleNotFoundError.","severity":"gotcha","affected_versions":"all"},{"fix":"Always provide 'native_value'. If you used 'state_class' before, set it explicitly if needed.","message":"In version 2.x, the SensorValue constructor changed: 'native_value' is now required and 'state_class' default removed.","severity":"breaking","affected_versions":"2.0.0+"},{"fix":"Convert datetime to timestamp: update.timestamp = datetime.now().timestamp()","message":"Timestamp is expected as a float (Unix timestamp). Passing a datetime object will cause a TypeError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'2.20.0':17 '2024':20 'activ':25 'assist':36 'bluetooth':13,29 'convert':9 'current':15 'data':4,32 'devic':14 'home':35 'home-assist':34 'last':18 'maintain':24 'model':5,33 'month':27 'pypi':23 'releas':21,28 'sensor':2,31 'sensor-data':30 'sensor-state-data':1 'sensordata':10 'state':3,11 'store':7 'updat':19 'version':16","created_at":"2026-06-07T12:59:25.378102+00:00","updated_at":"2026-06-07T12:59:25.378102+00:00","problems":[{"fix":"Install with 'pip install sensor-state-data' and import as 'from sensor_state_data import ...'","cause":"Wrong import path; hyphens vs underscores confusion.","error":"ModuleNotFoundError: No module named 'sensorstatedata'"},{"fix":"Pass native_value: SensorValue(name='temp', native_unit='°C', native_value=25.0)","cause":"Omitting native_value when constructing SensorValue.","error":"TypeError: SensorValue.__init__() missing 1 required positional argument: 'native_value'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/bluetooth-devices/sensor-state-data","github":"https://github.com/bluetooth-devices/sensor-state-data","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","iot"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}