MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Problem with MMM-ValuesByNotification and MMM-CommandToNotification

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    19 Posts 3 Posters 1.6k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      Jimmy1502 @sdetweil
      last edited by

      @sdetweil i have seen thath. But usually it shows me in the notifications that its not approved yet. But i couldnt find it. Thats why i was confused.

      S 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @Jimmy1502
        last edited by

        @Jimmy1502 I have seen the pending g list be empty when it’s not. maybe your side has the same problem

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        J 1 Reply Last reply Reply Quote 0
        • wishmaster270W Offline
          wishmaster270 Module Developer @Jimmy1502
          last edited by

          @Jimmy1502 I think the problem with the temperature is caused by the json path. The script outputs temperature_c and temperature_f but the json path causes the module to search for temperature only.

          The problem with the humidity may be caused by the interval you query the sponsor values. 10 seconds is very short for the dht sensor. Maybe you can try a bigger interval.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jimmy1502 @sdetweil
            last edited by

            @wishmaster270 I can see the temps now. I increased the UpdateInterval in both ValuesByNotification and CommandToNotification and made them different. But i still got the “0.00” for both temperature and humidity. But i dont think it should be the UpdateInterval. Cause when i tested the DHT22 with a Microcontroller i was able to get values every second.

            wishmaster270W 1 Reply Last reply Reply Quote 0
            • wishmaster270W Offline
              wishmaster270 Module Developer @Jimmy1502
              last edited by wishmaster270

              @Jimmy1502 As the reuseCount is set to 100 the wrong value need to be caused by the script sending them.
              It only sends 0.0 if a error occurs.

              You may remove the except block in the script and fire it very quickly on the shell to see what causes the error.

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                Jimmy1502 @wishmaster270
                last edited by

                @wishmaster270
                Hi! Ive been busy so i couldnt work on it. I removed the except block with five “#” for each line to make it a comment. And i get the following error. The line 32 has a syntax error “invalid syntax”. It is the print function printing json.dumps(result))

                wishmaster270W 1 Reply Last reply Reply Quote 0
                • wishmaster270W Offline
                  wishmaster270 Module Developer @Jimmy1502
                  last edited by

                  @Jimmy1502
                  You will need to comment the try, too. Additionally the indention of the code needs to be changed.
                  The file will be look like this then:

                  #!/bin/python3
                  #Install Dependencies:
                  #  pip3 install adafruit-circuitpython-dht
                  #  sudo apt-get install libgpiod2
                  import time
                  import board
                  import adafruit_dht
                  import json
                  import sys
                  
                  gpio_nr = 4
                  if len(sys.argv) > 1:
                      gpio_nr = int(sys.argv[1])
                  
                  
                  # Initial the dht device, with data pin connected to:
                  dhtDevice = adafruit_dht.DHT22(getattr(board, "D%d"%gpio_nr))
                  
                  result = {}
                  result["temperature_c"] = dhtDevice.temperature
                  result["humidity"] = dhtDevice.humidity
                  result["temperature_f"] = (result["temperature_c"]*1.8) + 32
                  result["error"] = False
                  
                  print(json.dumps(result))
                  
                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy