{"id":33251341,"url":"https://github.com/paphko/mmm-openhabfloorplan","last_synced_at":"2025-11-21T17:02:02.136Z","repository":{"id":73049859,"uuid":"67365897","full_name":"paphko/mmm-openhabfloorplan","owner":"paphko","description":"Magic Mirror² module to show lights and window states on a floorplan of an openhab server","archived":false,"fork":false,"pushed_at":"2025-03-03T08:42:32.000Z","size":52,"stargazers_count":32,"open_issues_count":0,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-03T09:33:22.547Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paphko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-09-04T20:09:42.000Z","updated_at":"2025-03-03T08:42:54.000Z","dependencies_parsed_at":"2023-07-04T17:07:02.670Z","dependency_job_id":null,"html_url":"https://github.com/paphko/mmm-openhabfloorplan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paphko/mmm-openhabfloorplan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphko%2Fmmm-openhabfloorplan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphko%2Fmmm-openhabfloorplan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphko%2Fmmm-openhabfloorplan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphko%2Fmmm-openhabfloorplan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paphko","download_url":"https://codeload.github.com/paphko/mmm-openhabfloorplan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphko%2Fmmm-openhabfloorplan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285655011,"owners_count":27209077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-21T02:00:06.175Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-17T00:00:30.828Z","updated_at":"2025-11-21T17:02:02.130Z","avatar_url":"https://github.com/paphko.png","language":"JavaScript","funding_links":[],"categories":["Hardware"],"sub_categories":[],"readme":"# Magic Mirror Module: mmm-openhabfloorplan\nThis [MagicMirror2](https://github.com/MichMich/MagicMirror) 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 [openhab](http://www.openhab.org/) server (working with openHAB 1.x, 2.x and 3.x).\nUnlike most other modules, the data can be pushed from the openhab server via http requests to the magic mirror, so state changes are immediately shown.\n\n![Example floorplan](https://forum.magicmirror.builders/uploads/files/1473878353822-openhabfloorplan-running.png \"Example floorplan\")\n\n## Installation\n\nIn your terminal, go to your MagicMirror's Module folder:\n````\ncd ~/MagicMirror/modules\n````\n\nClone this repository:\n````\ngit clone https://github.com/paphko/mmm-openhabfloorplan.git\n````\n\n## Preparing the Floorplan\n\nFirst of all, you should create an image showing your individual floorplan.\nYou can use `mmm-openhabfloorplan/images/floorplan-default.png` as template (shown [here](images/README.md)) and use an image editor like [paint.net](http://www.getpaint.net/index.html) to change it as you like.\nSave it as `mmm-openhabfloorplan/images/floorplan.png` (leave `floorplan-default.png` untouched).\n\n## Configuring the Module\n\nNow add the module to the modules array in the `config/config.js` file.\nYes, the configuration looks complicated, but there is quite a lot that can be configured.\nThe in-line comments should explain everything you need to know, so copy this sample configuration and adjust it to your individual openhab server, openhab items, and your floorplan.\nWhen you are done adding all items and positioning them as you like, change `draft` to false.\n````javascript\nmodules: [\n\t{\n\t\tmodule: 'mmm-openhabfloorplan',\n\t\tposition: 'bottom_left', // this can be any of the regions\n\t\tconfig: {\n\t\t\tupdateInterval: 60 * 60 * 1000, // refreshing all windows / lights / labels once per hour; 0 to disable periodic update\n\t\t\tdraft: true, // if true, all lights, windows, and label names are shown; if false, get states from openhab\n\t\t\topenhab: {\n\t\t\t\turl: \"http://openhab:8080\", // must not have a trailing slash!\n\t\t\t\t// user: \"\", // only if you have authentication enabled\n\t\t\t\t// password: \"\", // only if you have authentication enabled\n\t\t\t\tversion: 2, // supported are versions 1 and 2 (works also fine for openHAB 3)\n\t\t\t},\n\t\t\tfloorplan: {\n\t\t\t\timage: \"floorplan-default.png\", // image in subfolder 'images'; change to floorplan.png to avoid git repository changes\n\t\t\t\twidth: 400, // this must be the width of the image above\n\t\t\t\theight: 333, // this must be the height of the image above\n\t\t\t},\n\t\t\t// light: { // this part shows default settings for lights; may optionally be overwritten\n\t\t\t//\timage: \"light.png\", // located in subfolder 'images'\n\t\t\t//\twidth: 19, // image width\n\t\t\t//\theight: 19, // image height\n\t\t\t// },\n\t\t\t// window: { // this part shows default settings for windows; may optionally be overwritten\n\t\t\t//\tdefaultColor: \"red\", // css format, i.e. color names or color codes\n\t\t\t// },\n\t\t\t// label: { // this part shows default settings for labels; may optionally be overwritten\n\t\t\t//\tdefaultColor: \"grey\", // css format\n\t\t\t//\tdefaultSize: \"medium\", // value of font-size style, e.g. xx-small, small, medium, large, x-large, 1.2em, 20px\n\t\t\t// },\n\t\t\tlights: { // list all light items to be shown (must be of openhab type Switch or Dimmer)\n\t\t\t\t// format: \"openhab item (name is case-sensitive!): { left, top }\"\n\t\t\t\tL_Living:      { left: 80,  top: 110 },\n\t\t\t\tL_Sleeping:    { left: 80,  top: 240 },\n\t\t\t\tL_Garden:      { left: 310, top: 5 },\n\t\t\t\tL_Terrace:     { left: 70,  top: 5 },\n\t\t\t\tL_Front_Door:  { left: 238, top: 310 },\n\t\t\t\tL_Front_left:  { left: 40,  top: 310 },\n\t\t\t\tL_Front_right: { left: 340, top: 310 },\n\t\t\t\tL_Kitchen:     { left: 280, top: 110 },\n\t\t\t\tL_Entry:       { left: 210, top: 220 },\n\t\t\t},\n\t\t\twindows: { // list all window / door contacts to be shown (must be of openhab type Switch or Contact)\n\t\t\t\t// openhab item: left, top, radius (draws quadrant), midPoint, and optionally counterwindow and color\n\t\t\t\tReed_Door:           { left: 232, top: 289, radius: 32, midPoint: \"bottom-right\", color: \"orange\" },\n\t\t\t\tReed_Entry:          { left: 188, top: 298, radius: 23, midPoint: \"bottom-left\" },\n\t\t\t\tReed_Living:         { left: 12,  top: 106, radius: 29, midPoint: \"top-left\", counterwindow: \"vertical\" },\n\t\t\t\tReed_Dining_right:   { left: 170, top: 12,  radius: 29, midPoint: \"top-left\", counterwindow: \"horizontal\" },\n\t\t\t\tReed_Dining_left:    { left: 141, top: 12,  radius: 29, midPoint: \"top-left\" },\n\t\t\t\tReed_Kitchen:        { left: 283, top: 44,  radius: 30, midPoint: \"top-right\", color: \"orange\" },\n\t\t\t\tReed_Utility:        { left: 359, top: 180, radius: 29, midPoint: \"bottom-right\" },\n\t\t\t\tReed_Sleeping_right: { left: 12,  top: 231, radius: 30, midPoint: \"top-left\" },\n\t\t\t\t// openhab item: left, top, width, height (draws rectangle), and optionally color\n\t\t\t\tReed_Sleeping_left:  { left: 90,  top: 301, width: 37, height: 20 },\n\t\t\t\tReed_Bath:           { left: 275, top: 301, width: 37, height: 20 },\n\t\t\t},\n\t\t\tlabels: { // list all strings to be shown (may probably be any openhab type, resonable for String and Number)\n\t\t\t\t// openhab item: left, top, and optionally color, font size, prefix, postfix, and number of decimals for floating numbers\n\t\t\t\tTemperature_Entry:          { left: 162, top: 280 },\n\t\t\t\tTemperature_Living:         { left: 22,  top: 72,  decimals: 1 },\n\t\t\t\tTemperature_Dining_right:   { left: 200, top: 25,  color: \"white\", size: \"x-small\" },\n\t\t\t\tTemperature_Dining_left:    { left: 135, top: 25,  color: \"white\", size: \"x-small\" },\n\t\t\t\tTemperature_Utility:        { left: 345, top: 220, color: \"green\", decimals: 2 },\n\t\t\t\tTemperature_Sleeping_right: { left: 22,  top: 242, prefix: \"outside: \", postfix: \"°C\" },\n\t\t\t\tTemperature_Sleeping_left:  { left: 58,  top: 280, prefix: \"inside: \", postfix: \"°C\" },\n\t\t\t\tTemperature_Bath:           { left: 277, top: 280, postfix: \"°C\", decimals: 1 },\n\t\t\t}\n\t\t}\n\t},\n]\n````\n\n## Configuring Openhab\n\nIf you simply want to pull states with the update interval as configured above, you don't need to do any changes to your openhab configuration.\nBut it is really impressive if state changes are immediately (with less than 1sec delay in my case) shown on the mirror!\n\nFirst, you must have to change MagicMirror config:\n````\nvar config = {\naddress: \"192.168.0.11\", // IP of your MM server, for listening on it's @\nport: 8080,\nipWhitelist: [\"127.0.0.1\", \"::ffff:127.0.0.1\", \"192.168.0.12\", \"::1\"] // Add IP of your client, for listening since this @ ex:192.168.0.12 \n````\n\n\nThe easiest and least invasive way of configuring openhab to push state changes to the magic mirror server, is to add all items you want to update to a group gMagicMirrorItems and create the following rule:\n````\nval String mirrorUrl = \"http://\u003cMAGIC_MIRROR_URL\u003e:\u003cMAGIC_MIRROR_PORT\u003e/openhab\"\n\nrule \"send updates to MagicMirror\"\n\nwhen\n\tMember of gMagicMirrorItems changed\nthen\n\t\tvar url = mirrorUrl + \"?item=\" + triggeringItem.name + \"\u0026state=\" + triggeringItem.state\n\t\tsendHttpGetRequest(url)\n\t\tlogInfo(\"MagicMirror\",\"Sent to MM: \"+ url)\nend\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaphko%2Fmmm-openhabfloorplan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaphko%2Fmmm-openhabfloorplan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaphko%2Fmmm-openhabfloorplan/lists"}