def schedule_grow_for_shelf(grow: Grow, power_level: int, red_level: int, blue_level: int) -> None: config = AppConfig( ) # no arguments needed because it's a singleton instance shelf_grow_dict = { "grow": grow.to_json(), "power_level": power_level, "red_level": red_level, "blue_level": blue_level, } config.sio.emit("set_lights_for_grow", shelf_grow_dict) print("Event emitted from socketio obj")
def test_to_json(): start5 = datetime.utcnow() + timedelta(0, 4) start5 -= timedelta(microseconds=start5.microsecond) end = start5 + timedelta(0, 2) grow_to_json = Grow(1, 2, 3, 4, 5, start5, end) assert grow_to_json.to_json() == { "room_id": 1, "rack_id": 2, "shelf_id": 3, "recipe_id": 4, "recipe_phase_num": 5, "start_datetime": start5.replace( microsecond=0 ).isoformat(), "end_datetime": end.replace(microsecond=0).isoformat(), }