Hi folks,
An interactive floorplan is already a long time on top of my TODO list, so I developed an alfa version of node-red-contrib-ui-svg...
It would be nice if you could read the readme documentation, test it and give some 'constructive' feedback. Keep in mind that this is an early alfa version, that I published only to start the discussion!
I have already registered a list of known issues. For most of those issues I will need some input from the community. I'm not going to repeat all information here, but would be nice if somebody could have a look at them. You can put your feedback here (together with a link to the related issue on Github), so everybody can join the discussion.
Summarized:
- Via this node you can render an SVG drawing on your Node-RED dashboard.
- You can make SVG elements 'clickable', which means an output message will be created as soon as they are clicked.
- You can add animations to SVG elements, which can a.o. be triggered via input messages.
- You can change the SVG element attribute values via input messages.
Short demo of those major functionalities:
[{"id":"dacb48fa.613c18","type":"inject","z":"60ad596.8120ba8","name":"Start animation","topic":"trigger_animation","payload":"{\"elementId\":\"myanimation\",\"status\":\"start\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":660,"y":100,"wires":[["f55be9f2.fa96c8"]]},{"id":"d6e75e72.d2907","type":"inject","z":"60ad596.8120ba8","name":"Stop animation","topic":"trigger_animation","payload":"{\"elementId\":\"myanimation\",\"status\":\"stop\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":660,"y":140,"wires":[["f55be9f2.fa96c8"]]},{"id":"f55be9f2.fa96c8","type":"ui_svg_graphics","z":"60ad596.8120ba8","group":"ba24f321.07795","order":1,"width":"14","height":"10","svgString":"<svg preserveAspectRatio=\"none\" x=\"0\" y=\"0\" viewBox=\"0 0 900 710\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <image width=\"889\" height=\"703\" id=\"background\" xlink:href=\"https://www.roomsketcher.com/wp-content/uploads/2016/10/1-Bedroom-Floor-Plans.jpg\"/>\n <circle id=\"pir_living\" cx=\"310\" cy=\"45\" r=\"5\" stroke-width=\"0\" fill=\"#FF0000\"/>\n <text id=\"camera_living\" x=\"310\" y=\"45\" font-family=\"FontAwesome\" fill=\"blue\" stroke=\"black\" font-size=\"35\" text-anchor=\"middle\" alignment-baseline=\"middle\" stroke-width=\"1\"></text>\n</svg>","clickableShapes":[{"targetId":"camera_living"}],"smilAnimations":[{"id":"myanimation","targetId":"pir_living","attributeName":"r","fromValue":"0","toValue":"40","trigger":"msg","duration":"2","repeatCount":"0","freeze":false}],"name":"","x":920,"y":180,"wires":[["143d3982.25d516"]]},{"id":"143d3982.25d516","type":"debug","z":"60ad596.8120ba8","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1090,"y":180,"wires":[]},{"id":"149b89f6.d3d7f6","type":"inject","z":"60ad596.8120ba8","name":"Fill camera icon green","topic":"update_attribute","payload":"{\"elementId\":\"camera_living\",\"attributeName\":\"fill\",\"attributeValue\":\"green\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":680,"y":260,"wires":[["f55be9f2.fa96c8"]]},{"id":"9e4420e1.7bfd7","type":"inject","z":"60ad596.8120ba8","name":"Fill camera icon orange","topic":"update_attribute","payload":"{\"elementId\":\"camera_living\",\"attributeName\":\"fill\",\"attributeValue\":\"orange\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":680,"y":300,"wires":[["f55be9f2.fa96c8"]]},{"id":"bc43666d.7cd0f8","type":"inject","z":"60ad596.8120ba8","name":"Fill camera icon blue","topic":"update_attribute","payload":"{\"elementId\":\"camera_living\",\"attributeName\":\"fill\",\"attributeValue\":\"blue\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":670,"y":220,"wires":[["f55be9f2.fa96c8"]]},{"id":"ba24f321.07795","type":"ui_group","z":"","name":"Floorplan test","tab":"fb3be807.e7ef18","disp":true,"width":"14","collapse":false},{"id":"fb3be807.e7ef18","type":"ui_tab","z":"","name":"SVG","icon":"dashboard","disabled":false,"hidden":false}]
Thanks and have fun (hopefully ),
Bart