I’ve used this code sample for my OpenHAB 2.4 instance, too. Unfortunately it isn’t working.
After some tests I’ve found a solution which I would present here, too.
The main things was that zigbee.dot wasn’t created with values from my bridge. This results in an empty zigbee.svg file. Within zigbee.html.min was missing at the js link for svg-zoom lib.
Withing the rule there is another way needed to publish the networkmap request to mqtt. Found this in some other posts, too.
I post only changes (and some parts around) to the main post.
/etc/openhab2/html/zigbee.html
<html>
<head>
<script src="svg-pan-zoom.min.js"></script>
</head>
<body style="margin: 0; padding: 0">
<embed type="image/svg+xml" src="zigbee.svg" id="map" width="100%" height="100%"/>
<script language="JavaScript">
document.getElementById('map').addEventListener('load', function(){
// Will get called after embed element was loaded
svgPanZoom(document.getElementById('map'), {
controlIconsEnabled: true
});
})
var panZoomMap = svgPanZoom('#map');
</script>
</body>
</html>
Because of that I’ve used the MQTT Binding for OH 2.4 the way only through this item wasn’t working.
First I’ve created a thing for bridge and channel for networkmap
I’m having a little issue with the network map. It is basically working, so when the first rule is triggered zigbee2mqtt does its network scan etc (I can see this in the log).
However the handover to the second rule only works, when the string item zigbee_NetworkMap is null - and this is only after reboot.
Even when the network map changed due to new members, the rule isn’t triggered somehow. But at this point the string item should have changed?
So basically whenever I want to have a new network map, I have to reboot. Does anyone else have this problem or know a solution?
Update:
The item zigbee_NetworkMap ist refreshed after actions.publishMQTT("zigbee2mqtt/bridge/networkmap","graphviz"). Therefore the second rule is not triggered. The item state of zigbee_NetworkMap will remain the same even though zigbee2mqtt publishes a new one. Does anyone know why the item is not getting overwritten?
Update:
Seems like a bug in MQTT after reading a few topics in the forum. The publish action sometimes stops working. To solve this problem, delete the action from the rule, save the rule, clear the cache and then insert the action back into the rule. It should work from there on.
Thanks, I really like this solution and was starting to implement something similar. The svg approach is something which is much superior to the pngs, etc.
However, I have no problem with the bridge surrounding all things.
Thanks for sharing.
If it’s not blocked by the webview element from the app, you can enable this by svgPanZoom('#map', {viewportSelector: '.svg-pan-zoom_viewport', dblClickZoomEnabled: true});