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.

    MMM-DHT22

    Scheduled Pinned Locked Moved Utilities
    27 Posts 9 Posters 5.9k Views 9 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.
    • S Offline
      sdetweil @wishmaster270
      last edited by

      @wishmaster270 AND you must enable the virtual env in the script if pm2 starts MagicMirror

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      wishmaster270W 1 Reply Last reply Reply Quote 0
      • wishmaster270W Online
        wishmaster270 Module Developer @sdetweil
        last edited by

        @sdetweil Hi sam. My wrapper script will use the python binary in the virtual environment folder. This way the environment will be activated automatically.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @wishmaster270
          last edited by

          @wishmaster270 cool, you have the venv in the module folder

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • L Offline
            lif
            last edited by

            @wishmaster270 said in MMM-DHT22:

            source py-venv/bin/activate

            Same failure on install.

            from RPi import GPIO
            ModuleNotFoundError: No module named 'RPi'
            ```, 
            
            The output of pip freeze is ```
            MagicMirror/modules/MMM-Temperature/scripts $ source py-venv/bin/activate
            (py-venv) pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ pip freeze
            Adafruit-Blinka==8.66.2
            adafruit-circuitpython-busdevice==5.2.13
            adafruit-circuitpython-connectionmanager==3.1.5
            adafruit-circuitpython-dht==4.0.9
            adafruit-circuitpython-requests==4.1.13
            adafruit-circuitpython-typing==1.12.2
            Adafruit-PlatformDetect==3.84.0
            Adafruit-PureIO==1.1.11
            binho-host-adapter==0.1.6
            pyftdi==0.57.1
            pyserial==3.5
            pyusb==1.3.1
            sysv-ipc==1.1.0
            typing_extensions==4.15.0
            (py-venv) pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ deactivate
            pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ 
            

            The only difference from yours is mine is missing the second line.

            Hope this helps

            1 Reply Last reply Reply Quote 0
            • L Offline
              lif
              last edited by

              Hi,

              I’ve gone through your procedure again and this time it works.

              The only difference is that I run a python3 script to control screen blanking using a PIR before starting Magic Mirror, this time I didn’t start that script.

              With the PIR script and MagicMirror running I get:

              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ ./venvWrapper.py --venv-name py-venv --run ./dht22
              {"temperature_c": 23.5, "humidity": 53.7, "temperature_f": 74.30000000000001, "error": false}
              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ ./venvWrapper.py --venv-name py-venv --run ./dht22
              {"temperature_c": 23.5, "humidity": 53.7, "temperature_f": 74.30000000000001, "error": false}
              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ ./venvWrapper.py --venv-name py-venv --run ./dht22
              {"temperature_c": 0.0, "humidity": 0.0, "temperature_f": 32.0, "error": true}
              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ ./venvWrapper.py --venv-name py-venv --run ./dht22
              {"temperature_c": 23.6, "humidity": 53.5, "temperature_f": 74.48, "error": false}
              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ ./venvWrapper.py --venv-name py-venv --run ./dht22
              {"temperature_c": 0.0, "humidity": 0.0, "temperature_f": 32.0, "error": true}
              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ ./venvWrapper.py --venv-name py-venv --run ./dht22
              {"temperature_c": 23.7, "humidity": 53.3, "temperature_f": 74.66, "error": false}
              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ ./venvWrapper.py --venv-name py-venv --run ./dht22
              {"temperature_c": 23.8, "humidity": 53.2, "temperature_f": 74.84, "error": false}
              pi@mm:~/MagicMirror/modules/MMM-Temperature/scripts $ 
              
              

              I can live with that.

              Thanks for all your help

              1 Reply Last reply Reply Quote 0
              • 1
              • 2
              • 3
              • 3 / 3
              • 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