Magic Mirror

Didnt help, i even rebooted…

try put in custom.css

.MMM-homeassistant-sensors {
width : 200px; <== adjust according to the width you want
}

or inside the config itself of mmm-homeassistant-sensors
maxWidth: “200px” <== <== adjust according to the width you want

I got it figured out. It was an issue with my sensor actually. Thanks for the help.

Any change you know what I need for custom css?

Ive tried

.MMM-homeassistant-sensors {
  color: #3385ff;
  font-family: Airstream;
}

but no luck…

I just keep getting error fetching stats. anyone seen this?

  {
  module: 'MMM-homeassistant-sensors',
  position: 'bottom_left',
  config: {
  	url: 'https://blahblahblah',
  	prettyName: true,
  	stripName: false,
  	values: [
  	{
  			sensor: "sensor.mitemp_bt_temperature",
  			icons: [{
  					"default": "thermometer-lines"
  				}
  			]
  		}
  	]

  }

},

I had this plugin working nicely until I upgraded HASSIO to 0.83. Out of a sudden I get a “error fetching stats” on my MagicMirror. Any Idea what might be wrong? did something change for the REST API?

Which plugin are you using for MagicMirror?
There are 3 out there. :slight_smile:

In the end I had to change to a plugin which was capable of using the new authentication with a long lived token instead of the legacy API password:.

My configuration looks like this:

{
                 module: "MMM-HASS",
                 header: "Sensors",
                 position: "top_right",
                 config: {
                   host: "PUT IP HERE",
                   port: "8123",
                   apipassword: false,
                   hassiotoken: true,
                   https: false,
                   devices: [
                     { deviceLabel: "WM",
                         deviceReadings: [
                         { sensor: "sensor.wm", icon: "fa fa-plug", suffix: "W"}
                          ]
                     },
                     { deviceLabel: "3D-Printer",
                         deviceReadings: [
                         { sensor: "sensor.printer", icon: "fa fa-print", suffix: "%",}
                           ]
                     },
                     { deviceLabel: "Plant A",
                         deviceReadings: [
                         { sensor: "sensor.a", icon: "wi wi-humidity", suffix: "%"}
                          ]
                     },
                     { deviceLabel: "Plant B",
                         deviceReadings: [
                         { sensor: "sensor.b", icon: "wi wi-humidity", suffix: "%"}
                          ]
                     },
                     { deviceLabel: "Plant C",
                         deviceReadings: [
                         { sensor: "sensor.c", icon: "wi wi-humidity", suffix: "%"}
                          ]
                     },
                     { deviceLabel: "Plant D",
                         deviceReadings: [
                         { sensor: "sensor.d", icon: "wi wi-humidity", suffix: "%",}
                           ]
                     }
                  ]
                }

To get this working the long lived toked has to be handed over as environmental variable. For this purpose I created a magic mirror.config.js in the same folder as the mm.sh

module.exports = {
  apps : [
      {
        name: "MagicMirror",
        script: "./mm.sh",
        watch: true,
        env: {
          "HASSIO_TOKEN": „XXXXXXXXXXXX“
        }
      }
  ]
}

then I started the MM with

pm2 reload magic mirror.config.js

it works quite brilliantly

1 Like

Thanks for this.

Does it work with https? And nginx?

is it possible to change the returned state

My binary sensor returns on/off for the windows. i would like the magic mirror to display open/close

is this possible?

Use a template sensor instead of a binary sensor

1 Like

My magic mirror-error.log keeps on piling up as it gets all the states of every switch and sensor from my HA and had been eating up my sd card easily 20gb.

Is anyone experiencing the same problem as me?

hi, can you explain a little bit more, i got magic mirror addon, do i have to create a file?but where?thank you

Check the details I posted on Dec 18th. that is still valid.

basically follow the original instructions as posted in the magic mirror wiki

then, in the same folder where you’re supposed to create the mm.sh you’re also creating the magic mirror.js I was talking about in the previous post. This file actually calls the mm.sh but also hands over the long lived token as an environmental variable to magic mirror

Thanks but what i don’t understand is how to do it, having the Magic mirror addon

can you be a bit more specific, what exactly are you struggling to do?

  1. Did you install the Homeassistant Module for MagicMirror?
  2. Did you follow the guide in the wiki for auto starting Magicmirror using the mm.sh script and pm2?
  3. did you create the script for providing the token as I described earlier?

Need help. I have error in the code. No matter how I write.

modules: [
		{
			module: "alert",
		},
		{
			module: "updatenotification",
			position: "top_bar"
		},
		{
			module: "clock",
			position: "top_left"
		},
		{
			module: "calendar",
			header: "Feriados",
			position: "top_left",
			config: {
				calendars: [
					{
						symbol: "calendar-check",
						url: "https://www.calendarlabs.com/ical-calendar/ics/37/Brazil_Holidays.ics"					}
				]
			}
		},
		{
			module: "compliments",
			position: "lower_third"
		},
		
		{
                       module: "MMM-DarkSkyForecast",
                       header: "Tempo em Duque de Caxias",
                       position: "top_right",
                       classes: "default everyone",
                       disabled: false,
                       config: {
                         apikey: "****",
                         latitude: "-22.787860",
                         longitude: "-43.303140",      
                         iconset: "4c",
                         units: "si",
                         concise: false,
                         forecastLayout: "table"
                      }
                },
		{
			module: "newsfeed",
			position: "bottom_bar",
			config: {
				feeds: [
					{
						title: "Noticias R7",
						url: "https://noticias.r7.com/rio-de-janeiro/feed.xml"
					}
				],
				showSourceTitle: true,
				showPublishDate: true,
				broadcastNewsFeeds: true,
				broadcastNewsUpdates: true
			}
		},
                {
                       module: "MMM-HASS",
                       header: "Sensors",
                       position: "top_right",
                       config: {
                        host: "192.168.1.216",
                        port: "8123",
                        apipassword: false,
                        hassiotoken: true,
                        https: false,
                        devices: [
                          { deviceLabel: "WM",
                              deviceReadings: [
                              { sensor: "sensor.wm", icon: "fa fa-plug", suffix: "W"}
                               ]
                          }  
                              
                ]
	}
};

erro:

pi@raspberrypi:~/MagicMirror $ npm start

> [email protected] start /home/pi/MagicMirror
> ./run-start.sh

[02:59:17.194] [LOG]    Starting MagicMirror: v2.10.0
[02:59:17.226] [LOG]    Loading config ...
[02:59:17.241] [ERROR]  WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /home/pi/MagicMirror/config/config.js:117
if (typeof module !== "undefined") {module.exports = config;}
^^

SyntaxError: Unexpected token if
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:678:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
    at Function.Module._load (internal/modules/cjs/loader.js:551:3)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:20:18)

You are missing two closing brakets ( } ) at the end

I have the following error.

pi@raspberrypi:~/MagicMirror $ npm start

> [email protected] start /home/pi/MagicMirror
> ./run-start.sh

[21:04:03.127] [LOG] Starting MagicMirror: v2.10.0
[21:04:03.163] [LOG] Loading config ...
[21:04:03.185] [LOG] Loading module helpers ...
[21:04:03.191] [LOG] No helper found for module: alert.
[21:04:03.401] [LOG] Initializing new module helper ...
[21:04:03.405] [LOG] Module helper loaded: updatenotification
[21:04:03.408] [LOG] No helper found for module: clock.
[21:04:04.630] [LOG] Initializing new module helper ...
[21:04:04.633] [LOG] Module helper loaded: MMM-Screencast
[21:04:06.010] [LOG] Initializing new module helper ...
[21:04:06.013] [LOG] Module helper loaded: calendar
[21:04:06.016] [LOG] No helper found for module: compliments.
[21:04:07.345] [LOG] Initializing new module helper ...
[21:04:07.347] [LOG] Module helper loaded: MMM-DarkSkyForecast
[21:04:07.457] [LOG] Initializing new module helper ...
[21:04:07.460] [LOG] Module helper loaded: newsfeed
[21:04:07.548] [LOG] Initializing new module helper ...
[21:04:07.553] [LOG] Module helper loaded: MMM-HASS
[21:04:07.557] [LOG] All module helpers loaded.
[21:04:07.563] [LOG] Starting server on port 8080 ...
[21:04:07.688] [LOG] Server started ...
[21:04:07.695] [LOG] Connecting socket for: updatenotification
[21:04:07.703] [LOG] Connecting socket for: MMM-Screencast
[21:04:07.710] [LOG] Connecting socket for: calendar
[21:04:07.716] [LOG] Starting node helper for: calendar
[21:04:07.721] [LOG] Connecting socket for: MMM-DarkSkyForecast
[21:04:07.724] [LOG] ====================== Starting node_helper for module [MMM-DarkSkyForecast]
[21:04:07.729] [LOG] Connecting socket for: newsfeed
[21:04:07.734] [LOG] Starting module: newsfeed
[21:04:07.740] [LOG] Connecting socket for: MMM-HASS
[21:04:07.745] [LOG] Sockets connected & modules started ...
[21:04:07.748] [LOG]
Ready to go! Please point your browser to: http://localhost:8080
Starting chromium browser now, have patience, it takes a minute
 --disable-quic --enable-tcp-fast-open --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:411:19)
    at writeOrBuffer (_stream_writable.js:399:5)
    at Socket.Writable.write (_stream_writable.js:299:11)
    at Console.con.(anonymous function) [as log] (/home/pi/MagicMirror/node_modules/console-stamp/main.js:150:46)
    at process. (/home/pi/MagicMirror/js/app.js:40:10)
    at process.emit (events.js:198:13)
    at process._fatalException (internal/bootstrap/node.js:497:27)

I have no more error in the code. However does not pull anything and I have login error in HA.

I tried this solution(https://github.com/aserramonner/MMM-HASS/pull/13 ) but still have HA login error

I also detail some of the error here in this topic.

I have the following output error:

[00:06:50.643] [LOG]    Request URL: http://192.168.1.158:8123/api/states/sensor.caixa_dagua?api_password=juere3027
[00:06:51.232] [LOG]    Refreshed access token because it has expired. Expired at: 00:06:50 now is: 00:06:51
[00:06:51.244] [LOG]    Refreshed access token because it has expired. Expired at: 01:06:51 now is: 00:06:51
[00:06:51.412] [LOG]    { undefined: undefined, label: 'Quintal' }
[00:07:49.345] [LOG]    Request URL: http://192.168.1.158:8123/api/states/sensor.caixa_dagua?api_password=juere3027
[00:07:49.373] [LOG]    { undefined: undefined, label: 'Quintal' }

My configuration.yaml

homeassistant:
  whitelist_external_dirs:
    - /tmp
    - /config/temp/
  auth_providers:
      - type: legacy_api_password
        api_password: "juere3027"
  
      - type: trusted_networks
        trusted_networks:
          - 192.168.1.0/24
          - 127.0.0.1
          - ::1
        allow_bypass_login: true
      - type: homeassistant

my config.js

{
                module: "MMM-HASS",
                position: "top_right",
                config: {
                        host: "192.168.1.158",
                        port: "8123",
                        apipassword: "juere3027",
                        token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJkYTA5MDNjODg1N2M0OTVhYjgwZWE1OTI5YmFkOTgwNCIsImlhdCI6MTU3ODQ2MTc5MiwiZXhwIjoxODkzODIxNzkyfQ.sDGQpVvAD-0E6ZuO5ns2jDHNfq4OAg0VvCuuBpI5rqE",
                        hassiotoken: true,
                        https: false,
                        devices: [
                        { deviceLabel: "Quintal",
                                deviceReadings: [
                                { sensor: "sensor.caixa_dagua", icon: "mdi:waves", suffix: "%"}
                                
                                ]
                          }
                        
                               ]
                        }       
        
             },

PLEASE, CAN SOMEONE HELP ME. ONLY MISSING THIS MODULE TO CLOSE MY MIRROR :sob:

1 Like

Hi mate,

What tide module did you use?