GithubHelp home page GithubHelp logo

tom-hirschberger / mmm-screen-powersave-notification Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 83 KB

An MagicMirror² Module which turns the screen on and off based on notifications

License: MIT License

JavaScript 89.96% Shell 9.74% CSS 0.30%
magicmirror2 powersave

mmm-screen-powersave-notification's People

Contributors

tom-hirschberger avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

mmm-screen-powersave-notification's Issues

Turning Screen on/off with MQTT

Hi,

i'm having trouble to turn on and off the screen.

I've installed MQTTbridge and it's connected to the broker.
Then i've tested if xrandr is working and found that the default is set to WAYLAND not X11, so i turned back to X11 to get xrandr working "sudo raspi-config" - select "6 - advanced options" then "A6-Wayland" and switch to X11 (should be niticed in readme ;) found here

But i can't figure out how to toggle the xrandr_control script

When sending a payload OFF to the Topic MMM-Screen-Powersave-Notification is responding with SCREENSAVE_ENABLED but screen stays on. When sending ON, nothing happens ( i guess because Screen is already on)

config.js

{
	module: 'MMM-Screen-Powersave-Notification',
	config:
	{
		delay: 60,
		profiles:
		{
			screenStatusCommand: "./modules/MMM-Screen-Powersave-Notification/controlScripts/xrandr_control status HDMI-1",
			screenOnCommand: "./modules/MMM-Screen-Powersave-Notification/controlScripts/xrandr_control on HDMI-1", 
			screenOffCommand: "./modules/MMM-Screen-Powersave-Notification/controlScripts/xrandr_control off HDMI-1"
		}
	}
},

mqttDictionary.js

var mqttHook = [
    {
      mqttTopic: "magicmirror/state/monitor",
      mqttPayload: [
        {
          payloadValue: "ON",
          mqttNotiCmd: ["Command 1"]
        },
      ],
    },
    {
      mqttTopic: "magicmirror/state/monitor",
      mqttPayload: [
        {
          payloadValue: "OFF",
          mqttNotiCmd: ["Command 2"]
        },
      ],
    },
  ];
var mqttNotiCommands = [
    {
      commandId: "Command 1",
      notiID: "SCREEN_ON",
      notiPayload: {action: 'screenOnCommand'}
    },
    {
      commandId: "Command 2",
      notiID: "SCREEN_OFF",
      notiPayload: {action: 'screenOffCommand'}
    },
  ];

  module.exports = { mqttHook,  mqttNotiCommands};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.