Skip to content

feat: add Sense HAT integration module#3983

Closed
GEmanuel2558 wants to merge 1 commit intoMagicMirrorOrg:developfrom
GEmanuel2558:sensehat-integration
Closed

feat: add Sense HAT integration module#3983
GEmanuel2558 wants to merge 1 commit intoMagicMirrorOrg:developfrom
GEmanuel2558:sensehat-integration

Conversation

@GEmanuel2558
Copy link
Copy Markdown

Summary

This PR adds a new sensehat module for MagicMirror² that integrates with the Raspberry Pi Sense HAT. The module reads environmental and orientation data from the Sense HAT and can optionally control the 8×8 RGB LED matrix for simple status feedback.

What’s included

  • New frontend module:

    • modules/default/sensehat/sensehat.js
    • Displays temperature, humidity, pressure, and (optionally) orientation.
    • Supports configurable update interval, units (°C/°F), rounding, and basic threshold-based “warning” logic.
  • New Node helper:

    • modules/default/sensehat/node_helper.js
    • Periodically calls a Python helper to read sensor values.
    • Sends SENSEHAT_DATA notifications to the frontend.
    • Handles SENSEHAT_LED_COMMAND messages to control the LED matrix (e.g. status colors).
  • Python helper script:

    • modules/default/sensehat/python/reader.py
    • Uses the official sense_hat Python library.
    • Supports:
      • Sensor read mode (prints JSON with temperature, humidity, pressure, orientation, accel, gyro, magnetometer).
      • LED control mode (status color, text, clear).
  • Documentation & config:

    • modules/default/sensehat/README.md with usage notes and setup steps.
    • config/config.js.sample updated with an example sensehat module configuration.

Configuration

Example config:

{
  module: "sensehat",
  position: "top_right",
  config: {
    updateInterval: 5000,
    showTemperature: true,
    showHumidity: true,
    showPressure: true,
    showOrientation: false,
    temperatureUnit: "C",
    roundValues: 1,
    ledMatrixEnabled: true,
    ledMode: "status", // "off" | "status" | "text"
    ledText: "Hello from Sense HAT",
    ledColor: [0, 255, 0],
    criticalThresholds: {
      temperatureHigh: 30,
      temperatureLow: 10,
      humidityHigh: 80,
      humidityLow: 20
    },
    debug: false
  }
}

@sdetweil
Copy link
Copy Markdown
Collaborator

sdetweil commented Dec 6, 2025

This should be a third party module, not part of the base

@sdetweil
Copy link
Copy Markdown
Collaborator

sdetweil commented Dec 6, 2025

See the documentation
https://docs.magicmirror.builders/module-development/introduction.html

Also see my PythonPrint module for structure to call python script
https://github.com/sdetweil/MMM-PythonPrint

Your module Is really just a repackaging

@rejas
Copy link
Copy Markdown
Collaborator

rejas commented Dec 6, 2025

This should be a third party module, not part of the base

I agree.

@sdetweil
Copy link
Copy Markdown
Collaborator

sdetweil commented Dec 6, 2025

You based this on master branch
all new core changes must be against develop branch

please acknowledge that this PR will be rejected and you should repackage your module as a standalone.

@GEmanuel2558 GEmanuel2558 changed the base branch from master to develop December 6, 2025 21:50
@GEmanuel2558
Copy link
Copy Markdown
Author

Thank you for the code review, I will make a new MR, and will make sure to follow your advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants