I am new to OH 2. I have added virtual lights in my floorplan. I am trying to ON / OFF virtual lights in SVG floorplan.
I have created cursor, ng-class and ng-click for virtual light. When I click on the virtual light, it is not glowing (not changing its state). But log is showing that vitual lights is turned ON from OFF state when click on the lights. It is not reflected in floor plan.
2018-11-27 19:06:10.682 [ome.event.ItemCommandEvent] - Item 'Light_C_Corridor_Ceiling' received command OFF
2018-11-27 19:06:10.684 [thome.event.ItemStateEvent] - Light_C_Corridor_Ceiling updated to OFF
2018-11-27 19:06:10.687 [vent.ItemStateChangedEvent] - Light_C_Corridor_Ceiling changed from ON to OFF
2018-11-27 19:06:10.687 [GroupItemStateChangedEvent] - Lights changed from ON to OFF through Light_C_Corridor_Ceiling
2018-11-27 19:06:10.856 [ome.event.ItemCommandEvent] - Item 'Light_C_Corridor_Ceiling' received command ON
2018-11-27 19:06:10.856 [thome.event.ItemStateEvent] - Light_C_Corridor_Ceiling updated to ON
2018-11-27 19:06:10.857 [vent.ItemStateChangedEvent] - Light_C_Corridor_Ceiling changed from OFF to ON
2018-11-27 19:06:10.857 [GroupItemStateChangedEvent] - Lights changed from OFF to ON through Light_C_Corridor_Ceiling
2018-11-27 19:06:11.060 [ome.event.ItemCommandEvent] - Item 'Light_C_Corridor_Ceiling' received command OFF
2018-11-27 19:06:11.062 [thome.event.ItemStateEvent] - Light_C_Corridor_Ceiling updated to OFF
2018-11-27 19:06:11.062 [vent.ItemStateChangedEvent] - Light_C_Corridor_Ceiling changed from ON to OFF
2018-11-27 19:06:11.062 [GroupItemStateChangedEvent] - Lights changed from ON to OFF through Light_C_Corridor_Ceiling
2018-11-27 19:06:20.347 [ome.event.ItemCommandEvent] - Item 'Light_GF_Corridor_Ceiling' received command ON
2018-11-27 19:06:20.347 [thome.event.ItemStateEvent] - Light_GF_Corridor_Ceiling updated to ON
2018-11-27 19:06:20.348 [GroupItemStateChangedEvent] - Lights changed from OFF to ON through Light_GF_Corridor_Ceiling
2018-11-27 19:06:20.348 [vent.ItemStateChangedEvent] - Light_GF_Corridor_Ceiling changed from OFF to ON
2018-11-27 19:06:20.673 [ome.event.ItemCommandEvent] - Item 'Light_GF_Corridor_Ceiling' received command OFF
2018-11-27 19:06:20.673 [thome.event.ItemStateEvent] - Light_GF_Corridor_Ceiling updated to OFF
2018-11-27 19:06:20.673 [GroupItemStateChangedEvent] - Lights changed from ON to OFF through Light_GF_Corridor_Ceiling
2018-11-27 19:06:20.673 [vent.ItemStateChangedEvent] - Light_GF_Corridor_Ceiling changed from ON to OFF
2018-11-27 19:06:20.865 [ome.event.ItemCommandEvent] - Item 'Light_GF_Corridor_Ceiling' received command ON
2018-11-27 19:06:20.867 [thome.event.ItemStateEvent] - Light_GF_Corridor_Ceiling updated to ON
2018-11-27 19:06:20.868 [vent.ItemStateChangedEvent] - Light_GF_Corridor_Ceiling changed from OFF to ON
2018-11-27 19:06:20.868 [GroupItemStateChangedEvent] - Lights changed from OFF to ON through Light_GF_Corridor_Ceiling
Looking through your posts it seems to me that OH side of this problem is working just fine. Logs shows that your virtual items is switching its state. Isn’t the remaining part unrelated to openHAB?
Edit: Didn’t want to sound harsh. But opening new threads won’t get you any further.
I have not get reply for my old topic (Virtual Light). I dont have enough knowledge to confirm things based log file. I was expecting that .css file calling should be present in the log. I thought that OH is unable to invoke corresponding .css file. So I have started a new thread. I am new to OH, I learning functionality of OH community.
I have opened other thread for other issue, but I have not received input. Some time I am getting one time reply. Based on that, I am unable to progress further.
Actually, I am doing debugging and I am expecting help from other. I don’t know why .css file is not getting called because of that light color is not changing.
I also had problems with this, but i got it working.
Thats my solution:
The code in the svg:
style=“fill:#c83737;stroke-width:1.01305819;enable-background:new”
ng-class="{“light_on”: itemState(‘light_state_test’) == ‘ON’ ,“light_off”: itemState(‘light_state_test’) == ‘OFF’ }"
In the .css:
.light_on {
fill: #4fc497 !important;
}
.light_off {
fill: #c83737 !important;
}
I saw (in the other topic) that you have a “cursor: pointer” in the svg, do you need this? Maybe thats the problem
An other possible way what is working for me is to have two objects in the svg for one light.
When the light is on, i make the “OFF” object invisble, and when it’s off i make the “ON” object invisible
It is working. I can able to turn on and off the light in floor plan.
Light ON / OFF action is not working when I click any where on light image. Only particular point in light image, ON/OFF action is working. So I need to try with different light image or i need to add any attribute for that.