• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

show integer logs from python script as diagram in MM ?

Scheduled Pinned Locked Moved Requests
18 Posts 4 Posters 5.7k Views 4 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.
  • D Offline
    doubleT Module Developer @cruunnerr
    last edited by Feb 5, 2018, 8:43 PM

    @cruunnerr said in show integer logs from python script as diagram in MM ?:

    as u can read in my edit, i can create a JSON with the script i posted. but i don’t know where to put the script to execute it automatically every 24 hours or something like that.
    because i think using cronjob would be the wrong way, right? :D

    That’s exactly what a cronjob is for. ;)

    But yeah, that’s on the serving side. You have to make sure the file is updated (read, altered, saved) or overwritten entirely.

    I checked MMM-Chart and have the same issue, not even his own example is working. Tried some debugging but didn’t get very far. I don’t know what’s wrong.

    Let’s take a step back because I think there are some things that are not necessarry.
    You read the volume with a RasPi and it’s logged to a file on your NAS. Regular updates to that file work already?
    It’s also saved to a MySQL database?
    You have a Script that makes a JSON from the database? But it’s not yet regularly updated? Does this Script run on the measuring RasPi or the Mirror?

    I’d make the measuirng Pi save a JSON to the NAS. Make sure it’s working and the format is clean. MySQL database and another script are not necessarry that way. Then I’d make the Mirror read the JSON.

    Shoot me a PM (in German), I think I have an idea.

    1 Reply Last reply Reply Quote 1
    • D Offline
      doubleT Module Developer
      last edited by doubleT Feb 8, 2018, 10:24 PM Feb 8, 2018, 10:22 PM

      As promised, I changed a few things to my module and now it should work with your JSON (the one with the format you told me in PM:)

      [{"Datum":"2018-02-04","Volumen":2500},{"Datum":"2018-02-04","Volumen":2500}]
      

      In the future, I’d like to make this more independent with the key being set in the config (not everyone wants “Volumen” as key). There are some other to-do’s as well, but I had it running.

      Check it out and let me know: https://github.com/TTigges/MMM-Oiltank

      One note: It should work if you address your file with file: "http://192.168.0.123/yourfile.json" or whatever the ip of your NAS is. Check the readme for more info.

      It’s not yet ready to be presented as a full running module, so I’ll keep it low key in here for now.
      alt text

      1 Reply Last reply Reply Quote 1
      • C Offline
        cruunnerr
        last edited by Feb 10, 2018, 6:42 AM

        @doubleT

        Hey mate,

        tried your module and it works :D

        So atm i am using the python script to write the results to the mysql database. 2 minutes later runs a node app, which creates a JSON file and put that to my NAS.
        Your module grabs this JSON every hour and shows the results on my mirror :)
        For me the next step is to let the python script directly write a JSON file, but i need to find a solution for that.

        I appreciate with your ToDo list.
        It would be cool to set more things in the default config part. Things like refreshTime, high and width and if the chart will show dynamically or static. Last thing means, if the chart will show on the left side the scale from fix points (e.g. min. 0 Litre and max. 3000 Litre) or if it will show the scale depending on the last datas from the JSON (like atm).
        Just a thought… ^^

        And a very cool killer feature would be, to calculate the date, when the tank will be totally empty depending on the consumption from the last 100 days or something like that. But i think that would be too much. :D

        Anyhow i am just brainstorming. U did a great work, which i can directly use for my mirror and you have my greatest respect. Thank you and please let me know when i can help u with your ToDo list ^^

        So now i will take a look on your codes and try to understand what you did XD

        1 Reply Last reply Reply Quote 1
        • D Offline
          doubleT Module Developer
          last edited by Feb 10, 2018, 11:57 AM

          You are welcome. You’re also welcome to play with the code and adapt it to your needs and if you have suggestions on what to change, let me know.

          The module is ment to sit at the bottom and fill the whole width. Where would you like to place it alternatively? Some of that positioning is adjusted in the css right now, so depending on the position it would need different css settings.

          The prediction on when the tank will be empty is on my to do list (check the Code). Shouldn’t be too hard. But it’d involve read Ingo the dates and that’s something I kept out for now (internationally different time formats and all that).

          1 Reply Last reply Reply Quote 0
          • C Offline
            cruunnerr
            last edited by cruunnerr Feb 10, 2018, 2:37 PM Feb 10, 2018, 2:34 PM

            @doubleT Thats my actual sorting:

            I would like to show it in the middle below the clock.
            I installed the microwave sensor on my tank now and began measuring :)
            So a.t.m. there is only one log and now graph is shown ^^ Will wait now for the next log to see if everything is working fine :)

            I will play around with the code but today and tomorrow my nephew is to visit, so i need to move that :D

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