Skip to main content

Expose OVOS device sensors to IOT frameworks

Project description

PHAL Sensors

Expose sensor data from your OVOS device to various systems

  • Messagebus events
  • Home Assistant
  • MQTT

sensors will have a unique identifier of the format sensor.ovos_{name}_{sensor_id}

imagem

Dependencies

to enable pulseaudio sensors pip install pulsectl

to enable screen sensors pip install screen-brightness-control

to enable bluetooth sensors pip install pybluez2

to enable MQTT sensor logger pip install ha-mqtt-discoverable

Config

{
  "PHAL": {
    "ovos-PHAL-sensors": {
      "name": "my_phal_device",
      "time_between_checks": 15,
      "screen_sensors": true,
      "battery_sensors": true,
      "cpu_sensors": true,
      "memory_sensors": true,
      "network_sensors": true,
      "fan_sensors": true,
      "os_sensors": true,
      "apps_sensors": true,
      "pulseaudio_sensors": true,
      "bluetooth_sensors": true,
      "disable_bus": false,
      "disable_ha": false,
      "disable_filelog": true,
      "mqtt_config": {"host":  "192.168.1.8", "port": 1883},
      "ha_host": "http://192.168.1.8:8123",
      "ha_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2NGZmODYxY2M3ZDE0ZDZmODQ5..."
    }
  }
}
  • name - the device name the sensors belong to
  • time_between_checks - time to wait between reading sensors
  • disable_bus - do not emit sensors readings to bus
  • disable_ha - do not emit sensor readings to HA
  • disable_filelog - do not log sensors readings to file
  • ha_host (optional) - home assistant url (default to ovos-PHAL-plugin-homeassistant if previously configured)
  • ha_token (optional) - home assistant long lived access token (default to ovos-PHAL-plugin-homeassistant if previously configured)
  • mqtt_config (optional)
        host: str
        port: Optional[int] = 1883
        username: Optional[str] = None
        password: Optional[str] = None
        client_name: Optional[str] = None
        tls_key: Optional[str] = None
        tls_certfile: Optional[str] = None
        tls_ca_cert: Optional[str] = None

        discovery_prefix: str = "homeassistant"
        """The root of the topic tree where HA is listening for messages"""
        state_prefix: str = "hmd"
        """The root of the topic tree ha-mqtt-discovery publishes its state messages"""

Sensors Loggers

Currently 4 sensor data loggers are provided

  • HomeAssistant HTTP - if host and token are set the sensors will show up in home assistant
  • Messagebus - sensor readings are emitted as bus messages
  • FileLogger - sensor readings saved to "~/.local/state/sensors/readings.log"
  • MQTT - send readings to MQTT (Home Assistant compatible, use instead of HA logger)
Message("ovos.phal.sensor",
         {"state": sensor.value,
          "sensor_id": f"{name}_{unique_id}",
          "device_name": name,
          "name": unique_id,
          "attributes": sensor.attrs})

Message("ovos.phal.binary_sensor",
         {"state": sensor.value,
          "sensor_id": f"{name}_{unique_id}",
          "device_name": name,
          "name": unique_id,
          "attributes": sensor.attrs})

Sensors

PulseAudio

PAHostnameSensor
PAVersionSensor
PAChannelCountSensor
PAPlaybackSensor
PABluezActiveSensor
PABluezConnectedSensor
PANowPlayingSensor
PADefaultSourceSensor
PADefaultSinkSensor
PAAudioPlayingSensor

OS Info

OSNameSensor
OSSystemSensor
BootTimeSensor
ReleaseSensor
MachineSensor
ArchitectureSensor

Running Applications

SystemdSensor
DBUSDaemonSensor
KDEConnectSensor
PipewireSensor
PlasmaShellSensor
PulseAudioSensor
FirefoxSensor
SpotifySensor
MiniDLNASensor
UPMPDCliSensor

Memory Usage

MemoryTotalSensor
MemoryUsageSensor
SwapUsageSensor
SwapTotalSensor
DiskUsageSensor
DiskPercentSensor
DiskTotalSensor

CPU Usage

CPUTemperatureSensor
CPUUsageSensor
CPUCountSensor

Network Sensors

LocalIPSensor
ExternalIPSensor

Screen Sensors

ScreenBrightnessSensor

Battery Sensors

BatterySensor
BatteryChargeSensor
BatteryCurrentSensor
BatteryStoredEnergySensor
BatteryPowerSensor
BatteryStatusSensor
BatteryVoltageSensor

Fan Sensors

CpuFanSensor
GpuFanSensor

BluetoothSensors

BluetoothDevicePresence
BluetoothDeviceName
BluetoothSpeakerConnected

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ovos_phal_sensors-0.0.0a18.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ovos_phal_sensors-0.0.0a18-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file ovos_phal_sensors-0.0.0a18.tar.gz.

File metadata

  • Download URL: ovos_phal_sensors-0.0.0a18.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ovos_phal_sensors-0.0.0a18.tar.gz
Algorithm Hash digest
SHA256 80588f6c58773faef47029d671178970a056aaad2e89c1359f4862f42cb4341e
MD5 1f68060b48a513bc12d18bcec9263cf4
BLAKE2b-256 ecd83be52fc7a4b35065d9748c853d58f4ed46523c8bcdef2dd54b23401783bc

See more details on using hashes here.

File details

Details for the file ovos_phal_sensors-0.0.0a18-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_phal_sensors-0.0.0a18-py3-none-any.whl
Algorithm Hash digest
SHA256 642ddba76e3e39406a8aab0c3426eb3024803b617767d25f951b2771fd68adc5
MD5 2f4e1f24a3118135a9256969d68debdb
BLAKE2b-256 4bccb5adfb4560fd560a127c2f61939a605eaa3953b164972b5e26360a08dd12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page