vapor-ware / synse-emulator-plugin

Emulator plugin for Synse
GNU General Public License v3.0
3 stars 3 forks source link

Use of LED/Lock devices in the emulator has unexpected behavior #41

Closed lazypower closed 5 years ago

lazypower commented 5 years ago

The emulator seemingly takes these devices as shallow clones of the same device. Effecting change in state on a LED color or Lock state will alter every lock in the wedge/chamber in initial testing with a virtual chamber.

See: https://github.com/vapor-ware/cloud-ops/issues/59 for initial tests results when interacting from the keportal.

edaniszewski commented 5 years ago

yeah, basically all led and lock devices currently use the same global state (e.g. https://github.com/vapor-ware/synse-emulator-plugin/blob/master/pkg/devices/led.go#L18) so it you set it for one, you set it for all.

with the previous work to update readable device ranges via write (#38) this is actually super easy to fix -- instead of using global stat variables, just add an entry in the global device state map (https://github.com/vapor-ware/synse-emulator-plugin/blob/master/pkg/devices/device_state.go#L5) for that particular device, e.g.

https://github.com/vapor-ware/synse-emulator-plugin/blob/7693f8bd87b6d7f79d07d2cf077211e74ceaf64f/pkg/devices/temperature.go#L80-L85

lazypower commented 5 years ago

This went out the door with 2.4.2