Hereās my relevant items:
// HABPanel SVG Items
Switch SVGDisplayMotion
Switch SVGDisplayDoors
Switch SVGDisplayVideo
Switch SVGDisplayDiagnostics
Switch SVGDisplayLights
String SVGDisplayPanel
In my CSS file, I made these attributes:
.transparent {
opacity: 0 !important;
}
.button-selected {
fill: #0000FF !important;
}
Then in Inkscape I grouped all the similar elements by layer. Make a layer, name it, and adjust it so itās above the background (I made a background layer as well), and then open the layer itself in the XML editor. Then add an SVG attribute to the layer itself. In my example, I added the following ng-class
attribute:
{'transparent': itemState('SVGDisplayVideo') == 'OFF' }
If viewing my video layer in code, it looks like this (URL API keys redacted):
<g
inkscape:groupmode="layer"
id="layer11"
inkscape:label="Video"
style="display:inline"
ng-class="{'transparent': itemState('SVGDisplayVideo') == 'OFF' }">
<image
y="1240"
x="1640"
id="image10029"
xlink:href="http://192.168.1.180:8082/camera1url.jpg"
height="220"
width="280"
ng-click="sendCmd('Dashboard', 'Security Video')" />
<image
width="220"
height="140"
xlink:href="http://192.168.1.180:8082/camera2url.jpg"
id="image10153"
x="1380"
y="1060"
inkscape:transform-center-x="2.7436242"
inkscape:transform-center-y="-74.077853" />
</g>
Then make a button using the rectangle tool. I added text over it and used added the following ng-click
attributes to both the text and the rectangle:
sendCmd('SVGDisplayVideo', (itemState('SVGDisplayVideo') == 'ON') ? 'OFF' : 'ON')
I also added this ng-class
attribute to the rectangle:
{"button-selected": itemState('SVGDisplayVideo') == 'ON' }
Hopefully this is helpful.
I need to do some more work with the cameras but itās not at the top of my priority list right now. Iām thinking Iāll use a proxy item that will both change to the live view dashboard and change the source for a web frame to show the proper camera.
I did note that limitation - in my use case the picture is little more than a thumbnail so it didnāt really matter, but I can see where that would be frustrating if youāre looking to use it to view a live feed.