binarybucks / homA

An extensible framework for the smart home
Eclipse Public License 1.0
137 stars 24 forks source link

Webinterface toggles the wrong switch #139

Closed stylpen closed 8 years ago

stylpen commented 9 years ago

I've got a very easy setup with 2 devices both having only a power switch. Something like this:

/devices/Switch 1/controls/Power : 0
/devices/Switch 1/controls/Power/meta/type : switch
/devices/Switch 2/controls/Power : 0
/devices/Switch 2/controls/Power/meta/type : switch

When the second switch is clicked the first is actually flipped. When more of those switches are added always the first one is flipped. This happens in every room view (the virtual rooms "all" and 2unassigned" as well as named rooms): If you have for example 2 rooms with 2 switches each always the topmost switch in the current room is toggled.

I guess the reason is that all of these switches have the same id: <input type="checkbox" value="1" id="Power">. Maybe we should randomize the IDs that they are unlikely to be equal. Having multiple switches with different names works fine.