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

    Posts

    Recent Best Controversial
    • Black screen with cursor fixed it self?

      I had magic mirror for, about a year and a half. There was one failure due to bad sd card, so it was upgraded to SSD. Started having random blank screen with cursor and I couldn’t find any problems. Made update to version 2.20. It worked for a few weeks and problem came back. I didn’t shut it off because I was runnung pihole on the same RPI3.
      A week a go, i replaced my airlive router with OPNsense running on thin client, and MagicMirror simply started working again.
      One thing i noticed is slightly better latency on the internet. And pihole is still running on that same Pi.

      posted in Troubleshooting
      K
      Kereknjek
    • RE: MMM-ArduPort

      I tried that.

      @Kereknjek said in MMM-ArduPort:

      Now, when running

      python arduport.py
      

      I get this:

      {"debug": "SerialPort shell started..."}
      {"debug": "Waiting Ardunio to connect on port..."}
      {"status": {"data": "connected", "name": "connect"}}
      {"status": {"data": "starting", "name": "setup"}}
      {"status": {"data": "started", "name": "setup"}}
      {"sensor": {"data": "0.02", "name": "Baterija"}}
      {"sensor": {"data": "-0.00", "name": "Struja"}}
      {"sensor": {"data": "0.00", "name": "Solarno"}}
      {"sensor": {"data": "-0.12", "name": "Panel"}}
      {"sensor": {"data": "-0.00", "name": "Inverter"}}
      {"sensor": {"data": "0.04", "name": "Baterija"}}
      {"sensor": {"data": "-0.00", "name": "Struja"}}
      {"sensor": {"data": "0.00", "name": "Solarno"}}
      
      posted in Troubleshooting
      K
      Kereknjek
    • RE: MagicMirror electrical cabinet door

      Well, I have abandoned ArduPort. Never got it to work. So I switched to json-feed.

      It wasn’t easy for me because I had zero knowledge about http requests. But I got it working.

      For anyone, with limited knowlege, like me, here is the code I’m sending from arduino ethernet server:

      void sendjson(EthernetClient cl)
      {
          // send a standard http response header
          cl.println("HTTP/1.0 200 OK");
          cl.println("Content-Type: application/json");
          cl.println("Connection: close");
          cl.println();
          // 
          cl.println("{"); // start of json data
          cl.print("\"Info\":\" ");
          if(y==true){cl.print("ERR COM");} // error in comunication
          if(y==false){
            if(inverterukljucen==1){
              cl.print("ON"); // system is on
              }
              else
              {
                cl.print("OFF"); // system is off i.e. no sun
              }
            }
          cl.println("\",");
          
          cl.print("\"Baterija\":\" "); // battery voltage
          cl.print(naponbaterije);
          cl.println(" V\",");
      
          cl.print("\"Struja\":\" "); // current going in or ouf trom battery
          cl.print(strujabaterije);
          cl.println(" A\",");
      
          cl.print("\"Proizvodnja\":\" "); // production of electricity
          cl.print(snagapanela);
          cl.print(" W / ");
          cl.print((snagapanela/560)*100);
          cl.println("%\",");
      
          cl.print("\"Teret\":\" "); // load at inverter side
          cl.print(snagainvertera);
          cl.print(" W / ");
          cl.print((snagainvertera/1200)*100); // load percentage
          cl.println(" %\"");
      
          cl.println("}"); //end of json data
      }
      

      And json data received by MM:

      {
      "Info":" ON",
      "Baterija":" 26.15 V",
      "Struja":" -0.79 A",
      "Proizvodnja":" 6.72 W / 1.20%",
      "Teret":" 27.52 W / 2.29 %"
      }
      

      And result:
      alt text

      Back of the cabinet (I have to tie those cables):
      alt text

      posted in Show your Mirror
      K
      Kereknjek
    • RE: MMM-ArduPort

      It seems I’m having isues with Python.

      I have reinstaled Python and Python3, npm, python-shell and node js. Nothing worked. It was sending errors even with blank arduino, arduino sending only “starting” and “started” commands…
      So, due to my lack of knowlege of Python or anything else surrounding ArduPort, I’m abandoning it…

      To bad. It is very elagant module.

      posted in Troubleshooting
      K
      Kereknjek
    • RE: MMM-ArduPort

      How do I do that?

      posted in Troubleshooting
      K
      Kereknjek
    • RE: MMM-ArduPort

      I have reinstaled all original files for arduport and started debuging… Again.:smiling_face_with_open_mouth_cold_sweat:

      I didn’t mention it before, but I’m running MM on Raspbian lite.
      I’ve found I had problems with python. Force reinstalling modules solved it.

      I have allso found some errors in arduino.py,
      Had to change:

      rgxData = re.compile("[\[][a-zA-Z0-9-].*[\:][a-zA-Z0-9-].*[\:][a-zA-Z0-9-.].*[\]]")
      

      to

      rgxData = re.compile("[\[][a-zA-Z0-9\-].*[\:][a-zA-Z0-9\-].*[\:][a-zA-Z0-9\-\.].*[\]]")
      

      and

      incoming = self.arduino.readline(self.arduino.in_waiting).decode('ascii').replace('\r', '').replace('\n', '')
      

      to

      incoming = self.arduino.readline(self.arduino.in_waiting).decode('ascii', errors="ignore").replace('\r', '').replace('\n', '')
      

      Now, when running

      python arduport.py
      

      I get this:

      {"debug": "SerialPort shell started..."}
      {"debug": "Waiting Ardunio to connect on port..."}
      {"status": {"data": "connected", "name": "connect"}}
      {"status": {"data": "starting", "name": "setup"}}
      {"status": {"data": "started", "name": "setup"}}
      {"sensor": {"data": "0.02", "name": "Baterija"}}
      {"sensor": {"data": "-0.00", "name": "Struja"}}
      {"sensor": {"data": "0.00", "name": "Solarno"}}
      {"sensor": {"data": "-0.12", "name": "Panel"}}
      {"sensor": {"data": "-0.00", "name": "Inverter"}}
      {"sensor": {"data": "0.04", "name": "Baterija"}}
      {"sensor": {"data": "-0.00", "name": "Struja"}}
      {"sensor": {"data": "0.00", "name": "Solarno"}}
      

      I’m guesing, this should be working now. But ArduPort is still stuck at “Waiting for connection…”

      Here is C/P from my config.js

                    {
                    module: "MMM-ArduPort",
                    position: "top_right",
                    header: "Solarni sustav",
                    config:{
                            portname: "/dev/ttyUSB0",
                            updateInterval: 1,
                            animationSpeed: 1000,
                            displayIcons: false,
                            showDescriptopn: true,
                            hideLoading: false,
                            hideWaiting: false,
                            useColors: false,
                            sensors: [
                                    {
                                    name: "Solarno",
                                    description: "Solarni sustav",
                                    maxValue: 5,
                                    maxFormat: "({0}) ",
                                    highestValue: 4,
                                    highestFormat: "({0}) Greska - pregrijavanje",
                                    highValue: 3,
                                    highFormat: "({0}) Greska - preopterecenje",
                                    lowValue: 2,
                                    lowFormat: "({0}) Backup mod",
                                    lowestValue: 1,
                                    lowestFormat: "({0}) Ukljuceno",
                                    minValue: 0,
                                    minFormat: "({0}) Iskljuceno"
                                    },
                                    {
                                    name: "Baterija",
                                    description: "Stanje baterije",
                                    maxValue: 26,
                                    maxFormat: "({0} V) Balansiranje",
                                    highestValue: 25.5,
                                    highestFormat: "({0} V) 100%",
                                    highValue: 24.87,
                                    highFormat: "({0} V) 75%",
                                    lowValue: 24.2,
                                    lowFormat: "({0} V) 50%",
                                    lowestValue: 11.74,
                                    lowestFormat: "({0} V) 25%",
                                    minValue: 23.2,
                                    minFormat: "({0} V) 0%"
                                    },
                                    {
                                    name: "Struja",
                                    description: "Punjenje ili praznjenje",
                                    maxValue: 20,
                                    maxFormat: "({0} A) Punjenje",
                                    highestValue: 10,
                                    highestFormat: "({0} A) Punjenje",
                                    highValue: 0,
                                    highFormat: "({0} A) ",
                                    lowValue: -20,
                                    lowFormat: "({0} A) Praznjenje",
                                    lowestValue: -40,
                                    lowestFormat: "({0} A) Brzo preznjenje",
                                    minValue: -60,
                                    minFormat: "({0} A) PREOPTERECENJE"
                                    },
                                    {
                                    name: "Panel",
                                    description: "Snaga solarnih panela",
                                    maxValue: 500,
                                    maxFormat: "({0} W)",
                                    highestValue: 400,
                                    highestFormat: "({0} W)",
                                    highValue: 300,
                                    highFormat: "({0} W)",
                                    lowValue: 200,
                                    lowFormat: "({0} W)",
                                    lowestValue: 100,
                                    lowestFormat: "({0} W)",
                                    minValue: 0,
                                    minFormat: "({0} W)"
                                    },
                                    {
                                    name: "Inverter",
                                    description: "Potrosnja invertera",
                                    maxValue: 1000,
                                    maxFormat: "({0} W)",
                                    highestValue: 800,
                                    highestFormat: "({0} W)",
                                    highValue: 600,
                                    highFormat: "({0} W)",
                                    lowValue: 400,
                                    lowFormat: "({0} W)",
                                    lowestValue: 200,
                                    lowestFormat: "({0} W)",
                                    minValue: 0,
                                    minFormat: "({0} W)"
                                    }
                                    ]
                            }
                    },
      

      EDIT:

      Here is C/P from chrome console:

      Starting module: MMM-ArduPort
      MMM-ArduPort.js:286 [MMM-ArduPort]:: MMM-ArduPort: status
      MMM-ArduPort.js:286 [MMM-ArduPort]:: MMM-ArduPort: {
          "action": "status",
          "name": "initialized"
      }
      MMM-ArduPort.js:286 [MMM-ArduPort]:: MMM-ArduPort: error
      MMM-ArduPort.js:286 [MMM-ArduPort]:: MMM-ArduPort: "pyshell-throw"
      MMM-ArduPort.js:123 [socketNotificationReceived::error]:
      
      posted in Troubleshooting
      K
      Kereknjek
    • MMM-ArduPort

      I’m having trouble setting up MMM-ArduPort. So if anyone can help…

      I have to point out that I’m using SAME serial port on arduino for communication with raspberry and RS485 network. For transmiting and receiveing data on RS485 I use fantastic EasyTransfer arduino library.

      Posible problem:
      When arduino receives data from RS485, it gets to TX pin on USB side and never gets to raspberry. Wich is good.
      When arduino is sending data, to transmit over RS485, it first have to activate transmision mode on RS485 module.
      In this situation, data is being sent from arduino TX to RS485 RX. But it is allso sent to USB RX, and to raspberry. Wich is bad. I gues.

      Here are symptoms:
      MM starts and ArduPort is waiting for arduino.
      I connect arduino, ArduPort receives “[status:setup:starting]” and “[status:setup:started]”
      ArduPort shows my sensors list and then it removes them and returns to “Waiting for connection…”

      My arduino code sends “[status:setup:starting]”, waits for 3 seconds and sends “[status:setup:started]” witch is normaly received by Arduport.
      But! Arduino then sends request for sensors status to RS485 wich is allso transmited to raspberry. I think that in this moment it switches to “Waiting for connection”.

      But, again, I have modified MMM-ArduPort.js so it doesen’t disconnect (commented ), and I have aded “this.isArduinoStarting = false;” and “this.isArduinoStarted = true;” right after "case ‘sensor’: "
      I modified this so arduino always stays connected, and data should be displayed whenever and whatever sensor data is received. And it actualy does switch to listing my sensors, but, again, sensor data isn’t shown.

      I taught that EasyTransfer requests that get to PI are chrashing communication, but after my mod, I can see that data is passed normaly and is not affected by EasyTransfer part.
      I gues, that part is discarded at this part in arduino.py

      match = re.match(rgxData, data)
      if match:
                  data = data[1:-1]
                  case, name, value = data.split(":")
                  to_node(case.lower(), {"name": name, "data": value})
      

      Here is photo of data being received on screen /dev/ttyUSB0 (yes… photo. I was in a hurry…)
      0_1578411025419_IMG_20200107_120847384 (Small).jpg

      Pictograms between [sensor:name:data] are EasyTransfer requests.

      I’ve even tryed this modification. It didn’t help.

      posted in Troubleshooting
      K
      Kereknjek
    • RE: MagicMirror electrical cabinet door

      I’m having trouble uploading pictures…

      But, I’m allso having trouble with MMM-ArduPort. It connects to arduino, shows sensors, and then returns to “waiting for connection…” :confused_face:

      posted in Show your Mirror
      K
      Kereknjek
    • RE: MagicMirror electrical cabinet door

      It’s been a while…

      So, I mounted my MM in place, customized it to my preference and enjoyed it for a while.

      If you read my other post about sending data from arduino to MM over ethernet, I’ve given up from it as I realy suck at programming web aplications.

      But, it’s not all lost. I’m running my “not so smart” home on multidrop RS485 network and my master node is right behind RPI3 running MM.

      So I made packet sniffing node using arduino nano.
      In short, it listens for packets that are interesting to be shown on MM, translates them to format for MMM-ArduPort and sends them over usb. If no packet is received in 5 minutes, than it sends request.

      So I installed MMM-ArduPort, configured config.js and then…
      Disaster! I was only getting black screen! I taught: “NOOOOO!!! I’m to ugly to watch my self in a mirror!”
      Started to remove modules one by one and nothing helped.
      So I deleted MagicMirror folder and went to reinstal. But instalation got frozen at “Updating packages”.
      Fortunatly, manual instalation worked. I reinstalled all modules and copied configuration from old config.js (yes, i made backup :D ), and finaly got it to work.

      Problem was that i have updated it prior installing MMM-ArduPort and somehow update crashed MM.

      Now it is 1:57 am so I’m going to sleep. Arduport will have to wait till morning.

      I’ll slap some new pictures tomorrow!

      posted in Show your Mirror
      K
      Kereknjek
    • MagicMirror electrical cabinet door

      So, here is my build…

      Electrical cabinet:
      Holds circuit brakers, patch pannel, network switches and NAS
      cabinett

      How it should look:
      test
      My wife and daughter likes it.

      And my test setup:
      test setup

      For now, I’m runnung it on VirtualBox running Raspbian like distro.
      I have one Raspberry PI 3 runing Pihole and tor proxy for now.
      I’ll add MagicMirror to that PI once I learn to fine tune MagicMirror and when my kids let me.

      I never expected it to look so good! :drooling_face:

      Technical:
      Rear is OSB board 12mm painted black
      Glass is blue(ish) tinted 6mm thick
      22" LED display, only VGA, working with RPI using adapter
      Aluminium L profiles 20x10x2mm to hold glass in place
      Dimensions are 205 cm tall, 33cm wide, 2 cm tick, heavy as f***.
      Between glass and board there is black cloth. Behind glass it has texture like display.
      On strong light, diplay is just visible because i taped black electrical tape to metal edges. And it slightly reflects light.

      posted in Show your Mirror
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      @sdetweil
      Thank you!
      Ill need some time to try it out.

      Mechanical or should I say, woodwork is finished. I’m still waiting for short hdmi cable, PIR sensor and hinges I ordered… It looks sexy alredy! Can’t wait to see it working.

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      @sdetweil said in MagicMirror and adruino over ethernet:

      @Kereknjek cool. You could make a little change and have it return just data.

      If the path is sensor1, send just sensor1’s data. Etc.

      Pretty easy, just a case stmt… you could make it json data pretty easy too…

      The request could ask for a sensor or block of sensors, and send raw data.

      Yes! That is what i’m looking for.
      But discussion went to arduino side.
      My problem is that I don’t know how to do it at magic mirror side.

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      Yes. Plus, if I would want to make any modifications to webpage, first I would have to shutdown arduino and whole solar system, pull sd card out, modify page, plug sd card back in and restart sytem.

      If sd card gets damaged in any way or get slow for some reason (had one like that on my 3D printer), whole system running on that arduino gets slow and unuseable.

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      It’s not stupid question.

      If arduino serves webpage, it should be served from sd card.
      To use sd card, you have to use sd card library, make decisions wether client wants whole web page or just data packets…
      All that takes a lot of memory and time to process. And arduino is slow and low on memory compared to RPi.
      For arduino is much simpler to detect “give me data” and send sensor ID and value.

      Plus, in my case, arduino mega has 16 amperemeters to read and 18 outputs to regulate.
      I wouldn’t like it if it gets stuck in code while inverter is working at full capacity. It could become fire hazard.

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      @sdetweil
      That part is perfectly clear.

      Here is C/P of what I am using now:

            client.println("< !DOCTYPE HTML >");
            client.println("< html >");
            client.print("Napon panela: ");
            client.print(PanelU);
            client.println(" V < br/>");
            client.print("Struja panela: ");
            client.print(PanelI);
            client.println(" A < br/>");
            client.print("Napon baterije: ");
            client.print(BatU);
            client.println(" V < br/>");
      

      .
      .
      .
      client.println(“< / html >”);

      That is slightly modified ethernet server sample program from ethernet library.

      Edit: had to add spaces because html wasn’t showing.

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      I think that this is way to extensive for my knowledge. I can’t make heads or tails out of it…

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      @sdetweil said in MagicMirror and adruino over ethernet:

      @Kereknjek I would see this module… MMM-ArduPort and how to send data from the arduino to the pi via serial

      I also had added an http server to my arduino ESP8266 NodeMCU and provided apis for data access as another route, which keeps the devices from having to be physically wired together

      Your MMM-ArduPort module looks EXACTLY like what I had in mind!
      I’ll give it a detailed examination. :D

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      Thank you!
      I’ll need some time to digest all the info you have provided. :smiling_face_with_open_mouth_cold_sweat:

      posted in General Discussion
      K
      Kereknjek
    • RE: MagicMirror and adruino over ethernet

      Arduino sends data formated as simple HTML page. Pure text.

      posted in General Discussion
      K
      Kereknjek
    • MagicMirror and adruino over ethernet

      Hello, everyone!
      I’m new here and to java programming. So I’ll have a lot of questions…

      I’m in process of buinding MagicMirror as a door for my electrical cabinet in my house.

      Anyway, I have build my own solar system using store bought solar panels and charge controller. Batteries are pulled from electrical forklift (460 kg) and as inverter, I’m using pure sine wave UPS used for powering servers in company I work at.

      To manage the system I’m using arduino nano wich is measuring panel voltage and current, battery voltage, battery current and current direction, inverter current, inverter temperature, and charge controller temperature.
      Data is transfered to arduino mega via rs485 located at my electrical cabinet. There arduino mega measures power usage and switches devices between solar and mains acording to load so battery doesent fall under 90% and maximum posible power produced by solar panels is used.

      Arduino mega, located at electrical cabinet, is running HTTP server to wich I can connect from my PC or mobile to view current status, statistics and errors.

      Now I want to make module for MagicMirror to display that data.

      Allso, I’m upgrading my natural gas heating system. I’m adding wood furnace and solar collectors. System will use similar management based on arduino and will probably be connected to MagicMirror.

      My problem is that I have no idea how to make javascript connection to arduino, nor how to send requests. But I can make responses from arduino in any format.

      P.S.
      Incidently, my surname is Magic. :smiling_face_with_sunglasses:

      posted in General Discussion
      K
      Kereknjek
    • 1 / 1