MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. DaVinki
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    D
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 19
    • Groups 0

    DaVinki

    @DaVinki

    0
    Reputation
    120
    Profile views
    19
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online
    Age 48
    Location Sweet lake city

    DaVinki Unfollow Follow

    Latest posts made by DaVinki

    • Send display status to MQTT

      Hi all,

      Not sure if this is the right category to post this, so forgive me if I’m wrong. Basically, what I am trying to do is create a Python script to regularly check the outcome of “vcgencmd display_power” and send this status via MQTT.
      This might allow me to sync the switch status on Home Assistent and Node Red. Using copy-paste, I have a start of a script, but it keeps giving error on the stdout variable. Could one of you please check?

      #!/bin/bash
      #!/usr/bin/env python3
      
      import paho.mqtt.client as mqtt
      import subprocess
      # This is the Subscriber
      
      def on_connect(client, userdata, flags, rc):
        print("Connected with result code "+str(rc))
        client.subscribe("thuis/woonkamer/scherm")
      
      output = subprocess.check_output(['vcgencmd display_power'], stdout=subprocess.PIPE)
      if stdout() == 'display_power 0':
        client.publish(topic, msg)
      
      client = mqtt.Client()
      client.connect("192.168.2.150",1883,60)
      
      #client.on_connect = on_connect
      #client.on_message = on_message
      
      client.loop_forever()
      
      
      posted in Troubleshooting
      D
      DaVinki
    • RE: Another PIR sensor

      @wishmaster270 No, it didn’t look like you took it personal, I just didn’t want you to on forehand.
      I Have indeed a second browser open on my laptop. Never thought of that being the issue… :-D

      Let’s close that one, and fiddle around with the timers a bit. My laptop shut down during lunchtime, and then I indeed saw the second screen show up.

      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @wishmaster270 The GPIO does indeed fire a lot. I’m sure it is a simple mechanism. I’m trying to figure out a way to “filter” the signals. Be it by a delay, a debounce or whatever… there should be a simple work-around, right? (Don’t take this personally please, my work as IT engineer let’s me think in solutions and workarounds)

      A small piece from the mm-out.log:

      [2020-04-26 12:58:43.092] [LOG]    [12:58:43] - MMM-OpeningHours : : Error:  timeout
      [2020-04-26 12:59:00.692] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
      [2020-04-26 12:59:00.694] [LOG]    MMM-GPIO-Notifications: Sending notifications of pin 22...
      [2020-04-26 12:59:00.695] [LOG]    CurProfile: pageOneEveryone
      [2020-04-26 12:59:00.696] [LOG]    CurProfileString: pageOneEveryone
      [2020-04-26 12:59:00.702] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
      [2020-04-26 12:59:00.872] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
      [2020-04-26 12:59:01.039] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
      [2020-04-26 12:59:01.111] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
      [2020-04-26 12:59:02.201] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
      [2020-04-26 12:59:02.252] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
      [2020-04-26 12:59:09.191] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
      [2020-04-26 12:59:09.192] [LOG]    MMM-GPIO-Notifications: Skipping pin 22 because the delay is not exceeded !
      [2020-04-26 12:59:17.471] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
      [2020-04-26 12:59:17.472] [LOG]    MMM-GPIO-Notifications: Skipping pin 22 because the delay is not exceeded !
      [2020-04-26 12:59:27.987] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
      [2020-04-26 12:59:27.989] [LOG]    MMM-GPIO-Notifications: Sending notifications of pin 22...
      [2020-04-26 12:59:27.991] [LOG]    CurProfile: pageOneEveryone
      [2020-04-26 12:59:27.992] [LOG]    CurProfileString: pageOneEveryone
      [2020-04-26 12:59:28.005] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
      [2020-04-26 12:59:28.102] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
      [2020-04-26 12:59:28.112] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
      [2020-04-26 12:59:28.537] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
      [2020-04-26 12:59:29.213] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
      
      
      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @wishmaster270 I’m using one of the cheaper sensors from a Chinese store. Doesn’t even have jumpers on it. Seems to me that setting the debounce ridiculously high would solve the issue of it keeping firing.

      Kind of at a lost here. Reading the PIN with a Python script gives a contiinue high, with an occasional low. However, setting the gpio_state to 0 doesn’t give any reaction. It also does not seem to react to changing the debounce or delay timers.

      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @wishmaster270 Hi,

      Almost there. :-) . I’ve got two pages, PIR sensor is working. I can see notifications switching from page one to page two. However, the sensor seems to bounce. I can see the “enter” notification for page two, and almost immediately see the “leave” notification for page two. Sometimes it indeed accidentally switches to page two though, so the mechanism itself is working.

      I Have been playing around with the debounce and delay timers, with no success.

      What I’m trying to accomplish is switch to page two when the PIR is triggered, and return to page one using a timer in ProfileSwitcher.

      Current config for GPIO-Notifications:

           {
                 module: 'MMM-GPIO-Notifications',
                  config: {
                '22': {
                gpio_state: 1,
                gpio_debounce: 1000,
                delay: 1000 * 20,
                notifications: [
                  {
                      'notification': 'PROFILE_DECREMENT_HORIZONTAL',
                      'profiles': 'pageOneEveryone',
                       },
                      ]
                      }
                      }
              },
      
      

      Doesn’t the “profiles” flag only trigger an action when that specific profile is active?

      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @sdetweil said in Another PIR sensor:

      @DaVinki said in Another PIR sensor:

      npm config:check is an incorrect command.

      yeh,

      npm run config:check

      i would disable each module one at a time yil I found the one hiding everything

      add
      disabled: true,
      after the module statement

      {
      module: name,
      disabled: true,
      position:
      config: {
      }
      }

      Yeah, the culprit is MMM-ProfileSwitcher. Somehow I can not get that config working.

      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @sdetweil said in Another PIR sensor:

      @DaVinki said in Another PIR sensor:

      MMM-GPIO-Notifications

      do

      cd ~/MagicMirror
      npm config:check
      

      black screen, open the developers console, ctrl-shift-i on the keyboard,
      and select the tab labeled ‘console’ and scroll up to see any errors, usually red text.

      npm config:check is an incorrect command.

      The black screen shows no errors. It states that the modules are hidden. Even the wallpaper module, which should be ignored.

      MMM-Wallpaper is suspended. module.js:198:7
      MMM-Wallpaper is hidden. MMM-ProfileSwitcher.js:113:25
      
      
      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @sdetweil said in Another PIR sensor:

      @DaVinki said in Another PIR sensor:

      {
          module: 'MMM-ProfileSwitcher',
          config: {
              // See 'Configuration options' for more information.
          {                                    // < ----- what is that ?
           module: 'MMM-Wallpaper',
           classes: 'pageOneEveryone',
          },                                   // < ----- what is that?
          } 
      }
      

      seems there are too many {}

      Removing the brackets results in a black screen. Assigning the wallpaper module to IgnoredModules class doesn’t change that. Using square brackets [] also breaks the config.

      I Checked for comma’s, opening and closing brackets, the usual suspects, but as far as I can see I didn’t miss any.

      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @sdetweil said in Another PIR sensor:

      {

      Code directly taken from the module page https://github.com/tosti007/MMM-ProfileSwitcher. Seems to me you need the bracket for a per module assignment of the class.

      posted in Requests
      D
      DaVinki
    • RE: Another PIR sensor

      @wishmaster270 Thanks for the reply. I Have been trying to get this to work, but some simple code breaks my config:

           {
                 module: 'MMM-GPIO-Notifications',
                  config: {
                      '22': {
                      gpio_state: 0,
                      gpio_debounce: 10,
                      delay: 1000,
                      notifications: [
                        {
                        notification: 'USER_PRESENCE',
                        payload: true,
                        profiles: 'pageOneEveryone',
                               },
                      ]
                      }
                      }
              },
          {
              module: 'MMM-ProfileSwitcher',
              config: {
                  // See 'Configuration options' for more information.
              {
               module: 'MMM-Wallpaper',
               classes: 'pageOneEveryone',
              },
              } 
          },
      

      When commenting out the " modules" config in ProfileSwitcher, my config.js works. Is there something I am missing, or should I first create configurations for every single module?

      posted in Requests
      D
      DaVinki