Coder Social home page Coder Social logo

marcelwinh / mmm-pimaticfloorplan Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 64 KB

This MagicMirror2 module allows you to show a floorplan of your house / apartment with the current state of lights, window contacts, and labels provided by a running pimatic server.

License: MIT License

JavaScript 100.00%
magicmirror pimatic javascript

mmm-pimaticfloorplan's Introduction

Magic Mirror Module: MMM-PimaticFloorplan

This MagicMirror2 module allows you to show a floorplan of your house / apartment with the current state of lights, window contacts, and labels provided by a running pimatic server.

Magic-Mirror Module MMM-PimaticFloorplan

Installation

In your terminal, go to your MagicMirror's Module folder:

cd ~/MagicMirror/modules

Clone this repository:

git clone https://github.com/marcelwinh/MMM-PimaticFloorplan.git

Preparing the Floorplan

First of all, you should create an image showing your individual floorplan. You can use MMM-PimaticFloorplan/images/floorplan-default.png as template (shown here) and use an image editor like paint.net to change it as you like. Save it as MMM-PimaticFloorplan/images/floorplan.png (leave floorplan-default.png untouched).

Configuring the Module

Now add the module to the modules array in the config/config.js file. Yes, the configuration looks complicated, but there is quite a lot that can be configured. The in-line comments should explain everything you need to know, so copy this sample configuration and adjust it to your individual pimatic server, pimatic items, and your floorplan. When you are done adding all items and positioning them as you like, change draft to false.

modules: [
	{
		module: 'MMM-PimaticFloorplan',
		position: 'bottom_left', // this can be any of the regions
		config: {
			draft: true, // if true, all lights, windows, and label names are shown; if false, get states from pimatic
			pimatic: {
				host :'host',
				port : 8080,
				user : '',
				passwd : '',
			},
			floorplan: {
				image: "floorplan.png", // image in subfolder 'images'; change to floorplan.png to avoid git repository changes
				width: 314, // this must be the width of the image above
				height: 419, // this must be the height of the image above
			},
			// light: { // this part shows default settings for lights; may optionally be overwritten
			//	image: "light.png", // located in subfolder 'images'
			//	width: 19, // image width
			//	height: 19, // image height
			// },
			// window: { // this part shows default settings for windows; may optionally be overwritten
			//	defaultColor: "red", // css format, i.e. color names or color codes
			// },
			// label: { // this part shows default settings for labels; may optionally be overwritten
			//	defaultColor: "grey", // css format
			//	defaultSize: "medium", // value of font-size style, e.g. xx-small, small, medium, large, x-large, 1.2em, 20px
			// },
			lights: { // list all light items to be shown (must be of pimatic type Switch or Dimmer)
				// format: "pimatic item (name is case-sensitive!): { left, top }"
				ikea_Light:      	{ left: 150,  top: 5, pimaticId: "ikeaLight.state" },
				led_bed:      	 	{ left: 80,  top: 280, pimaticId: "ledBed.state" },
				nightstand_light:	{ left: 50,  top: 280, pimaticId: "nightstandLight.state" },
				tv_backlight:      	{ left: 15,  top: 20, pimaticId: "tvBacklight.state", imageOn: 'customOn.png', imageOff:'customOff.png'},
				tv_status:   		{ left: 15, top: 140, pimaticId: "tv-status.presence", imageOn: 'tvOn.png', imageOff:'tvOff.png'},
			},
			windows: { // list all window / door contacts to be shown (must be of pimatic type Switch or Contact)
				// pimatic item: left, top, radius (draws quadrant), midPoint, and optionally counterwindow and color
				Window_Kueche:      { left: 220, top: 395, radius: 25, midPoint: "bottom-left", pimaticId: "fenster-kueche.contact", default: true},
				Window_SZ_rechts:   { left: 72, top: 395, radius: 25, midPoint: "bottom-left", pimaticId: "fenster-rechts.contact", default: true},
				Window_SZ_links:    { left: 122, top: 395, radius: 25, midPoint: "bottom-right", pimaticId: "fenster-links.contact", default: true},
				Window_Bad_links:   { left: 1, top: 242, radius: 20, midPoint: "bottom-left", pimaticId: "fenster-bad.contact", default: true},
				Window_Bad_rechts:  { left: 1, top: 222, radius: 20, midPoint: "top-left", pimaticId: "badezimmer-rechtes-fenster.contact", default: true},
				Window_WZ_rechts:   { left: 1, top: 108, radius: 21, midPoint: "top-left", pimaticId: "wohnzimmer-rechtes-fenster.contact", default: true},
				Window_WZ_links:    { left: 1, top: 130, radius: 21, midPoint: "bottom-left", pimaticId: "wohnzimmer-linkes-fenster.contact", default: true},
				Window_WZ_balkon:   { left: 80, top: 1, radius: 40, midPoint: "top-right", pimaticId: "balkontuer.contact", default: true},
			},
			labels: { // list all strings to be shown (may probably be any pimatic type, resonable for String and Number)
				// pimatic item: left, top, and optionally color, font size, prefix, postfix, and number of decimals for floating numbers
				Temperature_Flur:          		{ left: 162, top: 200, decimals: 1, color: "white", size: "medium", pimaticId: "wandthermostat-flur.temperature"},
				Temperature_Flur_soll:          { left: 162, top: 225, decimals: 1, color: "grey", size: "medium", pimaticId: "thermostat-flur.temperatureSetpoint"},
				Temperature_Kueche:         	{ left: 250,  top: 325,  decimals: 1, color: "white", pimaticId: "wandthermostat-kuche.temperature"},
				Temperature_Kueche_soll:        { left: 250,  top: 350,  decimals: 1, color: "grey", pimaticId: "thermostat-kueche.temperatureSetpoint"},
				Temperature_Schlafzimmer:   	{ left: 80, top: 325, color: "white", decimals: 1, pimaticId: "wand-thermostat-schlafzimmer.temperature"},
				Temperature_Schlafzimmer_soll:  { left: 80, top: 350, color: "grey", decimals: 1, pimaticId: "thermostat-schlafzimmer.temperatureSetpoint"},
				Temperature_Bad:    			{ left: 50, top: 205,  color: "white", decimals: 1, pimaticId: "wandthmerostat-bad.temperature"},
				Temperature_Bad_soll:    		{ left: 50, top: 230,  color: "grey", decimals: 1, pimaticId: "thermostat-bad-new.temperatureSetpoint"},
				Temperature_Wohnzimmer:        	{ left: 80,  top: 60, color: "white", decimals: 1, pimaticId: "wand-thermostat-wohnzimmer.temperature"},
				Temperature_Wohnzimmer_soll:    { left: 80,  top: 85, color: "grey", decimals: 1, pimaticId: "thermostat-couch.temperatureSetpoint", postfix: '\u00B0C', prefix: 'WZ Soll', image: 'customImage.png'},
			}
		}
	},
]

Configuration options

The following properties needs to be configured:

Option Description
host Hostname or IP of your pimatic home automation server.
port Port to connect to your pimatic server, configured in config.json of your pimatic installation
user User login name configured in config.json of your pimatic installation
passwd Passwd of your specified pimatic user login name
floorplan The name and size of the floorplan image
light The name and size of the light image
window Default color of the open windows and doors
label Default color and size of the labels
lights An array of lights in pimatic with their position on the floorplan and pimaticId, optional: imageOn, imageOff
windows An array of windows in pimatic with their position on the floorplan, orientation, defaultValue (closed) and pimaticId, optional: color
labels An array of labels in pimatic with their position on the floorplan and pimaticId, optional: color, size, decimals, prefix, postfix, image

Special Thanks

mmm-pimaticfloorplan's People

Contributors

marcelwinh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tariktahiri

mmm-pimaticfloorplan's Issues

request for more customizing ;)

hey marcel.

thank you for your plugin.. Pimatic that way looks really nice in MagicMirror :)

i have some requests for you, it would be cool if you could extend this functions:

  • is it possible to give the values unit-labels like 12°C or 55**%** and set a wording or an custom icon before the value?
    so it would be possible to display "Vorzimmer: 23.5°C" or show an icon of an thermometer before the value.

  • the icon for the light was only shown if the light was powered on, is it possible to show a different png-icon if the light was off?

  • it would be geneally nice to set a custom png-icon for a device like a stove, tv or computer to show the power-state of the device

maybe you have time for some code :)

thanks in advance
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.